To investigate the relationship between changes in blood glucose and blood lipid levels and the risk of thyroid cancer in patients with type 2 diabetes mellitus. A total of 159 patients with type 2 diabetes who were treated in our hospital between June 2018 and February 2021 were recruited and assigned into the observation group, including 136 patients with type 2 diabetes without thyroid cancer (nonthyroid cancer group) and 23 patients with type 2 diabetes complicated with thyroid cancer (thyroid cancer group), and 120 healthy subjects during the same period were selected as the control group. Glycated hemoglobin (HbAlc), total cholesterol (TC), triacylglycerol (TG), high density lipoprotein cholesterol (HDL-C), and low density lipoprotein cholesterol (LDL-C) were detected and compared. Pearson's method was conducted to analyze the correlation between serum HbAlc level and TC, TG, HDL-C, and LDL-C levels in patients with type 2 diabetes mellitus; multivariate logistic regression analysis was performed to analyze the influencing factors of thyroid cancer in patients with type 2 diabetes mellitus. The serum HbAlc level and the incidence of thyroid cancer in patients with type 2 diabetes mellitus in the observation group were significantly higher than those in the control group (P < 0.05). The levels of TC, TG, and LDL-C in patients with type 2 diabetes mellitus in the observation group were significantly higher than those in the control group, and the level of HDL-C was significantly lower than that in the control group (P < 0.05). The correlation analysis showed that serum HbAlc levels in patients with type 2 diabetes were positively correlated with TC and TG levels and negatively correlated with HDL-C levels (P < 0.05) and not correlated with LDL-C levels (P > 0.05). Compared with the type 2 diabetes patients without thyroid cancer, the serum HbAlc, TC, and TG levels of the patients with type 2 diabetes mellitus in the thyroid cancer group were significantly higher, and the levels of HDL-C were significantly lower (P < 0.05). There was no significant change in the level of LDL-C (P > 0.05). Multivariate logistic regression analysis showed that serum HbAlc, TC, and TC levels were all risk factors for thyroid cancer in patients with type 2 diabetes mellitus (P < 0.05), while serum HDL-C level was a protective factor for thyroid cancer in patients with type 2 diabetes mellitus (P < 0.05). Thyroid cancer in type 2 diabetes patients may be linked to elevated levels of blood HbAlc, TC, and TG. HbAlc may raise the risk of thyroid cancer in type 2 diabetes patients by modulating blood lipid levels, which might serve as a marker to assess the risk of thyroid cancer in type 2 diabetes mellitus patients. However, since this study did not conduct in vitro and in vivo experiments, how HbAlc affects the pathogenesis of thyroid cancer has not been described in this study, which is also our future research direction. It is expected to provide new ideas for the prevention and treatment of thyroid cancer.