Mold is a type of fungus and it reproduces via spores. Drying out the soil may put the spores in dormancy but may not kill them. Substituent watering will re-activate them. I strongly advise against using soil that you know has been infested with mold. If you must use it, it is best to heat it up to a high temperature.