I have a food dehydrator, which I've used in the past for chillies, apples and herbs. I intend to dry some tomatoes with it soon, a process that apparently takes about 8 hours at 60°C (140°F) (it actually took considerably longer in my case). This temperature is exactly at the top of the US FDA's danger zone and is unlikely to be maintained in an entire dehydrator with a thermostat in the air stream. Dehydrators also allow lower temperatures to be used (mine does 35–70°C). Sun-drying tomatoes takes place at an uncontrolled temperature, which we can assume is sometimes ideal for bacteria/mould growth. Apple rings are often dried cooler and take 12+ hours.
These are sliced/halved fruit/veg, so aren't protected by their skins; they wouldn't dry if they were (as I found with blueberries). And for much of the process they're rather wet. The pH is usually uncontrolled; apple slices may be dipped in lemon juice but only to keep them from turning brown.
So why don't we get mould/bacteria growth during the dehydration process?