ObjectiveTo investigate the associations of midlife diet quality with incident dementia and brain structure.DesignPopulation-based prospective study and cross-sectional study.SettingUK Biobank.ParticipantsIn total, 187,783 participants (mean age 56.8 years, 54.9% women) who completed the 24-hour recall dietary questionnaire were included in the prospective study. A subgroup of 25,380 participants (mean age 55.7 years, 52.9% women) with brain structure data were included in the cross-sectional study.Main exposure and outcome measuresCox proportional hazards models and linear regression models were used to examine the associations of seven diet quality scores, i.e., hPDI (Healthful Plant-based Diet index), MDS (Mediterranean Diet score), aMED (alternate Mediterranean diet), RFS (Recommended Food Score), DASH (Dietary Approaches to Stop Hypertension), MIND (Mediterranean-DASH Intervention for Neurodegenerative Delay diet) and AHEI-2010 (the Alternative Healthy Eating Index-2010), with incident dementia and brain structure (estimated using magnetic resonance imaging), respectively.ResultsDuring a total follow-up of 1,969,993 person-years, 1,363 (0.73%) participants developed dementia. Higher diet quality scores (except for hPDI) were consistently associated with a lower incidence risk of dementia (all P for trend<0.001). For instance, for RFS, the hazard ratios of the intermediate tertile group and the highest tertile group relative to the lowest tertile group were 0.85 (95% confidence interval [95%CI]=0.75 to 0.97) and 0.70 (95%CI=0.61 to 0.81), respectively. Moreover, higher diet quality scores were significantly associated with larger regional brain volumes including volumes of grey matter (GM) in the parietal and temporal cortex and volumes of the hippocampus and thalamus. For instance, higher RFS was associated with larger volumes of GM in the postcentral gyrus (β=16.05±4.08, P<0.001) and the hippocampus (β=5.87±1.26, P<0.001). A series of sensitivity analyses confirmed the main results.ConclusionGreater adherence to MDS, aMED, RFS, DASH, MIND, and AHEI-2010 were individually associated with lower risk of incident dementia and larger brain volumes in specific regions. This study shows a comprehensive picture of the consistent associations of midlife diet quality with dementia risk and brain health, providing mechanistic insights into the role of healthy diet in the prevention of dementia.Summary boxWhat is already known on this topicPrevious prospective studies and meta-analyses suggested significant associations between a few diet quality scores (i.e., MDS, DASH, MIND, and AHEI-2010) and the risk of dementia in different populations; however, the results did not reach agreement.Nutrient intakes or very few diet quality scores have been demonstrated to be associated with brain volumes derived from MRI. There is limited research on the associations of various diet quality scores with the risk of dementia and brain structures in the same population.What this study addsGreater adherence to MDS, aMED, RFS, DASH, MIND, and AHEI-2010, but not hPDI was individually associated with lower risks of incident dementia.Greater adherence to MDS, aMED, DASH, and AHEI-2010, especially RFS, was individually associated with larger brain volumes in special regions (e.g., parietal and temporal cortex, and hippocampus).This study shows a comprehensive picture of the consistent associations of midlife diet quality with dementia risk and brain health, providing mechanistic insights into the role of healthy diets in the prevention of dementia.