Diet diversity in early childhood promotes microbial diversity, influences the developing immune system, and has been linked to a reduced risk of immune-mediated diseases. This study aimed to determine the association between childhood diet diversity and later inflammatory bowel disease (IBD), for which data are limited. Questionnaire data from the population-based birth cohorts All Babies in Southeast Sweden (ABIS) and the Norwegian Mother, Father, and Child Cohort (MoBa), including participants from Southeast Sweden and Norway, were used to estimate a diet diversity score at ages 1 and 3 years. This score represents the diversity of intakes across 5 food groups comprising 11 subgroups. A higher score signifies higher diet diversity. We used linked health registry data to identify IBD diagnoses up to the year 2021. Cox regression and random-effect models were used to estimate pooled hazard ratios (aHRs) adjusted for sociodemographics, breastfeeding, and early-life antibiotic use. Among 81 272 children with 1 304 325 person-years of follow-up, 307 developed IBD. Diet diversity at ages 1 and 3 years was in pooled analyses not associated with later IBD (per one-unit increase, aHR = 0.96 [95% CI = 0.81-1.14] and aHR = 0.96 [95% CI = 0.83-1.11]). In MoBa, but not ABIS, a higher diet diversity at 1 and 3 years of age was inversely associated with ulcerative colitis (UC) (per one-unit increase, aHR = 0.78 [95% CI = 0.66-0.94] and aHR = 0.78 [95% CI = 0.65-0.95]). Still, pooled aHRs for UC as well as Crohn's disease approximated one. In this prospective study of 2 Scandinavian birth cohorts, no association was observed between early-life diet diversity and the subsequent risk of IBD.