Background: Individuals with diabetes have a 2–6 times higher risk of developing blood clots, which can contribute to cognitive dysfunction. Elevated blood sugar levels can lead to complications in the blood vessels, including those in the central nervous system. Objective: This study aimed to examine the relationship between age, gender, blood sugar levels, and duration of illness with cognitive function in people with Type 2 Diabetes Mellitus (T2DM). Methods: This was an observational analytic study using a cross-sectional design. Results: Statistical analysis showed a significant relationship between age and cognitive function in T2DM patients (p = 0.001, r = –0.859), indicating a very strong negative correlation. No significant relationship was found between gender and cognitive function (p = 0.850, r = –0.037), indicating a very weak correlation. Blood sugar levels were significantly associated with cognitive function (p = 0.001, r = –0.637), reflecting a strong negative correlation. Duration of illness was also significantly related to cognitive function (p = 0.001, r = –0.843), indicating a very strong negative correlation. Conclusion: here is a significant negative correlation between age, blood sugar levels, and duration of illness with cognitive function in T2DM patients, while gender shows no significant relationship. Further studies with additional variables, larger samples, and different methodologies are recommended to strengthen the evidence and provide more comprehensive insights.