BackgroundSocio-economic position (SEP) in adolescence may influence diet quality over the life course. However, knowledge of whether individual and environmental determinants of diet quality mediate the longitudinal association between SEP and diet quality is limited. This study examined whether and to what extent food-related capabilities, opportunities and motivations of adolescents mediated the longitudinal association between SEP in adolescence and diet quality in early adulthood overall and by sex.MethodsLongitudinal data (annual surveys) from 774 adolescents (16.9 years at baseline; 76% female) from ProjectADAPT (T1 (baseline), T2, T3) were used. SEP in adolescence (T1) was operationalized as highest level of parental education and area-level disadvantage (based on postcode). The Capabilities, Opportunities and Motivations for Behaviour (COM-B) model was used as a framework to inform the analysis. Determinants in adolescence (T2) included food-related activities and skills (Capability), home availability of fruit and vegetables (Opportunity) and self-efficacy (Motivation). Diet quality in early adulthood (T3) was calculated using a modified version of the Australian Dietary Guidelines Index based on brief dietary questions on intake of foods from eight food groups. Structural equation modelling was used to estimate the mediating effects of adolescents’ COM-B in associations between adolescent SEP and diet quality in early adulthood overall and by sex. Standardized beta coefficients (β) and robust 95% confidence intervals (CI) were generated, adjusted for confounders (T1 age, sex, diet quality, whether still at school, and living at home) and clustering by school.ResultsThere was evidence of an indirect effect of area-level disadvantage on diet quality via Opportunity (β: 0.021; 95% CI: 0.003 to 0.038), but limited evidence for parental education (β: 0.018; 95% CI: -0.003 to 0.039). Opportunity mediated 60.9% of the association between area-level disadvantage and diet quality. There was no evidence of an indirect effect via Capability or Motivation for either area-level disadvantage or parental education, or in males and females separately.ConclusionsUsing the COM-B model, the home availability of fruit and vegetables (Opportunity) of adolescents explained a large proportion of the association between area-level disadvantage in adolescence and diet quality in early adulthood. Interventions to address poor diet quality among adolescents with a lower SEP should prioritize environmental determinants of diet quality.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12966-023-01477-3.