I presume you're referring to the "Hygiene hypothesis" which links early childhood exposure to microorganisms with fewer allergies and autoimmune disorders.
It's important to note that this has not been demonstrated conclusively, and when medical professionals talk about it they stress that it's not worth exposing yourself to fecal matter intentionally to "build resistance." Personal cleanliness is still one of the more important things you can do for health.
A reasonable compromise seems to be: let your kids play in the dirt, but also teach them to wash their hands after using the bathroom.