Inflammatory diets are increasingly recognised as a modifiable determinant of mental illness. However, there is a dearth of studies in early life and across the full mental well-being spectrum (mental illness to positive well-being) at the population level. This is a critical gap given that inflammatory diet patterns and mental well-being trajectories typically establish by adolescence. We examined the associations of inflammatory diet scores with mental well-being in 11–12-year-olds and mid-life adults. Throughout Australia, 1759 11–12-year-olds (49 % girls) and 1812 parents (88 % mothers) contributed cross-sectional population-based data. Alternate inflammatory diet scores were calculated from a twenty-six-item FFQ, based on the prior literature and prediction of inflammatory markers. Participants reported negatively and positively framed mental well-being via psychosocial health, quality of life and life satisfaction surveys. We used causal inference modelling techniques via generalised linear regression models (mean differences and risk ratios (RR)) to examine how inflammatory diets might influence mental well-being. In children and adults, respectively, a 1 sd higher literature-derived inflammatory diet score conferred between a 44 % (RR 95 % CI 1·2, 1·8) to 57 % (RR 95 % CI 1·3, 2·0) and 54 % (95 % CI 1·2, 2·0) to 86 % (RR 95 % CI 1·4, 2·4) higher risk of being in the worst mental well-being category (i.e. <16th percentile) across outcome measures. Results for inflammation-derived scores were similar. BMI mediated effects (21–39 %) in adults. Inflammatory diet patterns were cross-sectionally associated with mental well-being at age 11–12 years, with similar effects observed in mid-adulthood. Reducing inflammatory dietary components in childhood could improve population-level mental well-being across the life course.