Carotenoids may help to prevent the ageing of the brain. Previous findings regarding β-carotene alone are not consistent. In the present study, we evaluated the cross-time association between a carotenoid-rich dietary pattern (CDP) and subsequent cognitive performance using a sample of 2983 middle-aged adults participating in the SU.VI.MAX (Supplémentation en Vitamines et Minéraux Antioxydants) study. Cognitive performance was assessed in 2007–9 using six neuropsychological tests, and a composite cognitive score was computed. The cognitive data were related to dietary data obtained by repeated 24 h dietary records (1994–6) and to measurements of baseline plasma concentrations of carotenoids (lutein, zeaxanthin, β-cryptoxanthin, lycopene, α-carotene, trans-β-carotene and cis-β-carotene). DP were extracted using the reduced rank regression method for 381 participants and then extrapolated to the whole sample using plasma carotenoid concentrations as response variables. Associations between a CDP and cognitive function measured 13 years later were estimated with ANCOVA providing mean difference values and 95 % CI across the tertiles of CDP. A correlation between CDP and consumption of orange- and green-coloured fruits and vegetables, vegetable oils and soup was observed. CDP was found to be associated with a higher composite cognitive score (mean difference 1·04, 95 % CI 0·20, 1·87, P for trend 0·02), after adjustment for sociodemographic, lifestyle and health factors. Similar findings were obtained for scores obtained in the cued recall task, backward digit span task, trail making test and semantic fluency task (all P for trend < 0·05). Further studies ought to confirm whether a diet providing sufficient quantity and variety of coloured fruits and vegetables may contribute to the preservation of cognitive function during ageing.