Yes it will help. Sterilizing potting soil is one of the best ways to prevent gnats from taking up residence on your indoor plants.