Mycelium growing in a container
It’s a Balance
It is very normal for their to be some fungal activity in your potting soil. The avoidance of fungal spores is a practical impossibility. Because your growing media must, of course, be watered for your vegetables, you are also watering it for fungal spores.
Fungi in your soil are not inherently a problem. In general, they’re just an agent of decomposition that is breaking down materials into components that your plants can use. The usually whitish stuff is called mycelium and it is the normal state of the fungus. When it fruits it makes the mushroom. It is definitely possible for the fungus to be so successful in the material that it interferes with the development of your plants.
Some fungi even cause diseases for your plants, such as damping off.
Controlling Excess
The surface of your garden soil is wet, of course, and if there is no breeze, there will be a zone high humidity near your soil. This encourages over-development of the fungi to the point that it can interfere with your plants.
I found this out the hard way. I moved my garden room from a room with a ceiling fan into a room without one. Our condo has a central unit and I leave the fan set to on when the windows are closed for air circulation. I thought it would be enough. It wasn’t.
Soon I had a very rapid spread of mycelium and mushrooms popping up from my potting soil. The answer, fortunately was simple. I put a fan in the room, which was not blowing directly at the plants.
I tried using the same ordinary box fan that I put in one of my windows when the outdoor temperatures are in my range. Even at the lowest setting it was really a bit much. I have closet in my garden room with a mylar covered door. I pointed the fan right at that, and it is still was enough wind to cause my nearby tomatoes to cast around.
As it happened I also had a small oscillating fan, that we used to use in the kitchen because the previous garden room arrangement in the dining area had reduced its airflow. It was perfect. I don’t remember what I paid for this thing, but it wasn’t much.
I live in a dry, mountainous area, and I don’t have the humidity issues that many do. When the house is closed all day and night, in the winter, my indoor humidity in the garden room is almost always around 45%. This is very convenient for me because it means I don’t to do anything to manage my humidity.
When the windows are open, I have the other problem. That is, the air is too dry. Frequently, in the afternoon, indoors, even in a room full of plants, it can be 30%. While I could close the place up and run an air conditioner when it got too hot inside, from our extreme solar gain, or just the temperature, I choose to grow vegetables that do well in my environment.
Most people live in much wetter places than I do. Some of you may run air conditioning much of the time, which will dry out your air, and may potentially provide adequate ventilation to your plants. You should probably have a device that is a combination thermometer and hygrometer (they measure humidity) on the wall of your garden room. They’re quite inexpensive these days.
If you are in that situation, and know that your humidity is below 60%, and are having mushrooms forming, then yours is basically the same case as mine, and you need another fan for more air circulation.
In more extreme cases, there are more radical ways of dealing with excess fungi. However, the best answer is to not let it get so extreme, by keeping your humidity below 60% and by keeping the air in motion.