BackgroundDepression can affect the development of cognitive functions, and there are many people with depressive symptoms and cognitive decline in the aging population. The role of mediators between depressive symptoms and the subsequent cognitive decline remains unclear. We aimed to investigate whether depressive symptoms can slow down cognitive decline through a mediator.MethodsA total of 3,135 samples were collected in 2003, 2007, and 2011. This study used the CES-D10 and SPMSQ (Short Portable Mental State Questionnaire) to measure depression and cognitive functions. The effect of depression trajectory on the subsequent cognitive dysfunction was analyzed using multivariable logistic regression, and the mediating effect was analyzed using the Sobel test.ResultsThe results of the multivariable linear regression analysis showed that after including different variables in each model, such as leisure activities and mobility in 2003 and 2007, women had a higher percentage of depressive symptoms in each model, compared to men. The effect of depression in 2003 on cognitive decline in 2011 was mediated by intellectual leisure activities in 2007 in men (Z=-2.01) and physical activity limitation in 2007 in women (Z=-3.02).ConclusionsThe mediation effect of this study shows that people with depressive symptoms will reduce their participation in leisure activities, which will lead to the degeneration of cognitive function. We suggest that if depressive symptoms are addressed as early as possible, people will have the ability and motivation to delay the decline of cognitive function through participation in leisure activities.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12877-023-03984-1.