Few studies, even those with cohort designs, test the mediating effects of infant gut microbes and metabolites on the onset of disease. We undertook such a study. Methods: Using SEM path analysis, we tested directional relationships between first pregnancy, birth mode, prolonged labour and breastfeeding; infant gut microbiota, metabolites and Immunoglobulin A; and childhood BMI and atopy in 1667 infants. Results: Following both cesarean birth, and prolonged labour with a first pregnancy, a higher Enterobacteriaceae/Bacteroidaceae (E/B) ratio at 3 months was the dominant path to overweight; higher E/B ratios and Clostridiodes difficile colonization at 12 months were the main pathway to atopic sensitization.