Neuroimaging-based brain-age delta has been shown to be a mediator linking cardiovascular risk factors to cognitive function. We aimed to assess the mediating role of brain-age delta in the association between modifiable risk factors of dementia and longitudinal cognitive decline in middle-aged and older individuals who are asymptomatic, stratified by Alzheimer's disease pathology. We also explored whether the mediation effect is specific to cognitive domain. In this cohort study, we included participants from the ALFA+ cohort aged between 45 years and 65 years who were cognitively unimpaired and who had available structural MRI, cerebrospinal fluid β-amyloid (Aβ)42 and Aβ40 measurements obtained within 1 year of each other, modifiable risk factors assessment, and cognitive evaluation over 3 years. Participants were recruited from the Barcelonaβeta Brain Research Center (Barcelona, Spain). Included individuals underwent a first assessment between Oct 25, 2016, and Jan 28, 2020, and a follow-up cognitive assessment 3·28 (SD 0·27) years later. We computed brain-age delta and composites of different cognitive function domains (preclinical Alzheimer's cognitive composite [PACC], attention, executive function, episodic memory, visual processing, and language). We used partial least squares path modelling to explore mediation effects in the associations between modifiable risk factors (including cardiovascular, mental health, mood, metabolic or endocrine history, and alcohol use) and changes in cognitive composites. To assess the role of Alzheimer's disease pathology, we computed separate models for Aβ-negative and Aβ-positive individuals. Of the 419 participants enrolled in ALFA+, 302 met our inclusion criteria, of which 108 participants were classified as Aβ-positive and 194 as Aβ-negative. In Aβ-positive individuals, brain-age delta partially mediated (percent mediation proportion 15·73% [95% CI 14·22-16·66]) the association between modifiable risk factors and decline in overall cognition (across cognitive domains). Brain-age delta fully mediated (mediation proportion 28·03% [26·25-29·21]) the effect of modifiable risk factors on the PACC, wherein increased values for risk factors correlated with an older brain-age delta, and, consequently, an older brain-age delta was linked to greater PACC decline. This effect appears to be primarily driven by memory decline. Mediation was not significant in Aβ-negative individuals (3·52% [0·072-4·17]) on PACC, although path coefficients were not significantly different from those in the Aβ-positive group. Our findings suggest that brain-age delta captures the association between modifiable risk factors and longitudinal cognitive decline in middle-aged and older people. In asymptomatic middle-aged and older individuals who are Aβ-positive, the pathology might be the strongest driver of cognitive decline, whereas the effect of risk factors is smaller. Our results highlight the potential of brain-age delta as an objective outcome measure for preventive lifestyle interventions targeting cognitive decline. La Caixa Foundation, the TriBEKa Imaging Platform, and the Universities and Research Secretariat of the Catalan Government. For the Spanish translation of the abstract see Supplementary Materials section.