ABSTRACT Purpose Population aging is one of the great achievements of humanity. However, with aging, the incidence of chronic diseases and those related to cognition deficits increase. In this way, strategies aimed at preventing or delaying cognitive deficit are extremely necessary. Thus, this study investigates the relationship between cognitive deficits, schooling and eating habits in a Brazilian elderly population. Methods The dietary habits of 400 older adults were investigated through structured questionnaires. Unhealthy eating habits such as low consumption of fruits, vegetables and beans, consumption of fatty meats and whole milk, adjusted for other variables, were evaluated. Cognitive function was assessed by the Mini Mental State Examination (MMSE). Data were analyzed by Chi-square test and binary logistic regression. Results There was cognitive deficit prevalence of 17.7% in the study population, which increases with age progression. The low frequency of vegetable consumption increased the risk of cognitive deficit in the crude analysis by 47.6% and increased these odds by 44.1% after the final adjustment. Low educational level was also associated with cognitive deficit of individuals (28.25%). Conclusion Educational level and vegetable consumption in adult life and in later adulthood improve cognition.