Urban development has profoundly reduced human exposure to biodiverse environments, which is linked to a rise in human disease. The ‘biodiversity hypothesis’ proposes that contact with diverse microbial communities (microbiota) benefits human health, as exposure to microbial diversity promotes immune training and regulates immune function. Soils and sandpits in urban childcare centres may provide exposure to diverse microbiota that support immunoregulation at a critical developmental stage in a child's life. However, the influence of outdoor substrate (i.e., sand vs. soil) and surrounding vegetation on these environmental microbiota in urban childcare centres remains poorly understood. Here, we used 16S rRNA amplicon sequencing to examine the variation in bacterial communities in sandpits and soils across 22 childcare centres in Adelaide, Australia, plus the impact of plant species richness and habitat condition on these bacterial communities. We show that sandpits had distinct bacterial communities and lower alpha diversity than soils. In addition, we found that plant species richness in the centres' yards and habitat condition surrounding the centres influenced the bacterial communities in soils but not sandpits. These results demonstrate that the diversity and composition of childcare centre sandpit and soil bacterial communities are shaped by substrate type, and that the soils are also shaped by the vegetation within and surrounding the centres. Accordingly, there is potential to modulate the exposure of children to health-associated bacterial communities by managing substrates and vegetation in and around childcare centres.