The increasing prevalence of dementia and cognitive impairments in the aging global population poses significant challenges to healthcare and society. Detecting cognitive impairment is crucial for managing diseases like Alzheimer's, yet current research faces limitations such as reliance on cross-sectional studies and a lack of understanding of causal relationships. In response, our study introduces a dynamic causal graph-based learning approach for predicting cognitive impairment risk in middle-aged and older adults. Employing a longitudinal perspective, we uncover causal structures through causal discovery methods, offering profound insights into cognitive changes over time. Our model, utilizing dynamic input variables, outperforms traditional algorithms while enhancing interpretability. This innovative approach not only improves prediction accuracy but also contributes to a deeper comprehension of the causal mechanisms underlying cognitive impairment. The longitudinal insight offers a comprehensive understanding of evolving factors associated with cognitive changes, making our model valuable for both research and practical applications.