Grow Boxes and a fungus problem

These grow boxes hold 4 gallons of water under the soil for the plants. I am having a fungus problem that I would think could only be coming from the water being some what stagnating under the soil. As it just waiting to be sucked up to feed the plants. Is there something I can put in the water to keep fungus from starting in the water holding part of the grow box without it being a problem to the plants?
Keep growing