Diet may be an important modifiable risk factor for maintenance of cognitive health in later life. This study aimed at examining associations between common dietary indices and dietary patterns defined by factor analysis and cognitive function in older community-dwelling adults. Dietary information for 1499 participants from the Rancho Bernardo Study was collected in 1988⁻1992 and used to calculate the alternate Mediterranean diet score, Alternate Healthy Eating Index (AHEI)-2010 score and factor scores derived from factor analysis of nutrients. Global cognitive function, executive function, verbal fluency and episodic memory were assessed at approximate four-year intervals from 1988⁻2016. Linear mixed models were used to examine associations between dietary patterns and cognitive trajectories. Estimates for the highest vs. lowest tertile in models adjusting for age, sex, education, energy intake, lifestyle variables and retest effect showed greater adherence to the Mediterranean score was associated with better baseline global cognitive function (β (95% CI) = 0.33 (0.11, 0.55)). The AHEI-2010 score was not significantly associated with cognitive performance. Higher loading on a plant polyunsaturated fatty acid (PUFA)/vitamin E factor was associated with better baseline global cognitive function and executive function (β = 0.22 (0.02, 0.42) and β = -7.85 (-13.20, -2.47)). A sugar/low protein factor was associated with poorer baseline cognitive function across multiple domains. Dietary patterns were not associated with cognitive decline over time. Adherence to a healthy diet with foods high in PUFA and vitamin E and a low sugar to protein ratio, as typified by a Mediterranean diet, may be beneficial for cognitive health in late life.