Emerging evidence implicates gut microbial metabolism in neurodevelopmental disorders, but its influence on typical neurodevelopment has not been explored in detail. We investigated the relationship between the microbiome and neuroanatomy and cognition of 381 healthy children, demonstrating that differences in microbial taxa and genes are associated with overall cognitive function and the size of brain regions. Using a combination of statistical and machine learning models, we showed that species including Alistipes obesi, Blautia wexlerae, and Ruminococcus gnavus were enriched or depleted in children with higher cognitive function scores. Microbial metabolism of short-chain fatty acids was also associated with cognitive function. In addition, machine models were able to predict the volume of brain regions from microbial profiles, and taxa that were important in predicting cognitive function were also important for predicting individual brain regions and specific subscales of cognitive function. These findings provide potential biomarkers of neurocognitive development and may enable development of targets for early detection and intervention.