The relationship between dietary habits and microbiota composition during adolescence has not been well examined. This is a crucial knowledge gap to fill considering that diet–microbiota interactions influence neurodevelopment, immune system maturation and metabolic regulation. This study examined the associations between diet and the gut microbiota in a school-based sample of 136 adolescents (Mage = 12·1 years; age range 11–13 years; 48 % female; 47 % Black, 38 % non-Hispanic White, 15 % Hispanic or other minorities) from urban, suburban and rural areas in the Southeast USA. Adolescents completed the Rapid Eating Assessment for Participants and provided stool samples for 16S ribosomal RNA gene sequencing. Parents reported their child and family socio-demographic characteristics. The associations between diet and socio-demographics with gut microbiota diversity and abundance were analysed using multivariable regression models. Child race and ethnicity, sex, socio-economic status and geographic locale contributed to variation within microbiota composition (β-diversity). Greater consumption of processed meat was associated with a lower microbial α-diversity after adjusting for socio-demographic variables. Multi-adjusted models showed that frequent consumption of nutrient-poor, energy-dense foods (e.g. sugar-sweetened beverages, fried foods, sweets) was negatively associated with abundances of genera in the family Lachnospiraceae (Anaerostipes, Fusicatenibacter and Roseburia), which are thought to play a beneficial role in host health through their production of short-chain fatty acids (SCFAs). These results provide new insights into the complex relationships among socio-demographic factors, diet and gut microbiota during adolescence. Adolescence may represent a critical window of opportunity to promote healthy eating practices that shape a homoeostatic gut microbiota with life-long benefits.