Patients with thalamic infarction experience abnormal blockages of multinucleated vessels, affecting the body and thereby the thalamus. Most patients with thalamic infarction have an adverse prognosis, which seriously affects their safety. Therefore, it is essential to analyze the independent risk factors that influence the prognosis of patients with thalamic infarction and develop corresponding preventive measures. To explore the effect of non-high-density lipoprotein cholesterol (non-HDL-C) and Homocysteine (Hcy) levels in cognitive impairment in thalamic infarction. From March 2019 to March 2022, 80 patients with thalamic infarction were divided into a group with cognitive impairment [Montreal Cognitive Assessment (MoCA) score < 26; 35 patients] and a group with normal cognitive function (MoCA score of 26-30; 45 patients) according to the MoCA score. In addition, 50 healthy people in the same period were selected as the control group. A correlation between the non-HDL-C and Hcy levels and the MoCA score and receiver operating characteristic curve was observed, and the serum non-HDL-C and Hcy levels were analyzed for the diagnosis of cognitive impairment in patients with thalamic infarction. According to the Modified Rankin Scale (MRS) score, 80 patients with thalamic infarction were divided into a good prognosis group (MRS score ≤ 2) and a poor prognosis group (MRS score >2). The non-HDL-C and Hcy levels were significantly higher in the group with cognitive impairment than in the group with normal cognitive function (P < 0.05). There was no significant difference in the non-HDL-C level between the control group and the group with normal cognitive function (P > 0.05). The MoCA scores of the group with cognitive impairment were significantly lower than those of the group with normal cognitive function and the control group (P < 0.05). There was a significant difference between the control group and the group with normal cognitive function (P < 0.05). The non-HDL-C and Hcy levels were correlated with the MoCA score (P < 0.05), cognitive impairment [areas under the curve (AUC) = 0.709, 95% confidence interval (95%CI): 0.599-0.816], the non-HDL-C level, and could predict cognitive impairment in patients with thalamic infarction (AUC = 0.738, 95%CI: 0.618-0.859). Hcy combined with non-HDL-C levels can predict cognitive impairment in patients with thalamic infarction (AUC = 0.769, 95%CI: 0.721-0.895).There were 50 patients in the good prognosis group and 30 patients in the poor prognosis group. Compared with the good prognosis group, in the poor prognosis group, the National Institutes of Health Stroke Scale (NIHSS) score, non-HDL-C level, Hcy level, large-area cerebral infarction, atrial fibrillation, and activated partial prothrombin time were statistically significant (P < 0.05). The non-HDL-C level, the Hcy level, the NIHSS score, extensive cerebral serum, and atrial fibrillation may all be independent risk factors for poor prognosis in patients with thalamic infarction (P < 0.05). Non-HDL-C and Hcy levels are positively correlated with cognitive impairment in patients with thalamic infarction. Non-HDL-C and Hcy levels can be used in the diagnosis of cognitive impairment in patients with thalamic infarction, and the combined detection effect is better. The main factors affecting the prognosis of patients with thalamic infarction are the non-HDL-C level, the Hcy level, the NIHSS score, large-area cerebral infarction, and atrial fibrillation. Clinically, corresponding preventive measures can be formulated based on the above factors to prevent poor prognosis and reduce mortality.