Why does the main battery discharge with the alternator running?
Our mechanic had a similar issue with a Piper Cherokee where the battery would only charge intermittently.  It turned out there was a bad connection at the Master Switch which ran from the Alternator/voltage regulator to the Master Switch. Most of these types of electrical issues tend to be bad wiring. I would check your wiring thoroughly.