One of my step-dads is a microbiologist. He wasn't involved in dirt analysis, but he certainly never had any trouble with us eating dirt. It was just what kids do.
But there's a lot of paranoia about eating dirt in the popular culture. Wash everything. Use antibiotic soaps. Toxins everywhere. Lead in dust in play lots. Toxoplasmosis in the sandbox.
What to do? We can home-test for lead in our garden dirt (the little test kits work on dirt, too), but ... well, beyond that, what?
And is it really needful? The hygiene hypothesis says it is important to be rather not-clean, as a child. To eat germs, even potentially get infected with parasites - it boosts immune function amazingly, being exposed to those relatively (cough) harmless bacteria found in the garden. Presuming you have one, I suppose.
I ran across an article by a microbiologist (actually from the same university where my step-dad taught and researched many years ago) about eating dirt. The article (linked below) is both scary and encouraging, and philosophical and multi-disciplinary... eating dirt is a human behavior that is essential and not at all uncommon around the world. It is, in fact, expected that pregnant women in some areas will naturally eat a lot of dirt. Kids tend to eat loam (topsoil), pregnant women dig for the good stuff. Eating dirt isn't just part of being human, at a fundamental level, eating dirt helps MAKE us fully human, at our best expression of that.
The depth of how it works, how it intersects with our sense of self at the biological level and beyond, that's what fascinated me about this article. (Learning how much dirt consumption was considered normal was also pretty interesting.)
It is worth reading the whole article.