IntroductionAs the world ages, dementia places a heavy burden on society and the economy, but current methods of diagnosing dementia are still limited and there are no better therapies that target the causes of dementia. The purpose of this work is to explore the relationship between thyroid disease, thyroid stimulating hormone (TSH) concentrations, free tetraiodothyronine (FT4) concentrations and cognitive function.MethodsThis study utilized cognitive function and thyroid data from the 2011–2012 National Health and Nutrition Examination Survey (NHANES) to assess the relationship between different groups of TSH and FT4 concentrations and cognitive function using weighted logistic regression and restricted cubic spline (RCS), and then used two-sample Mendelian Randomization (MR) to assess the causal relationship between hyperthyroidism, hypothyroidism, TSH and FT4 concentrations with dementia.ResultsOur analysis of the 2011–2012 NHANES data showed that the individuals with low TSH concentrations had higher Alzheimer’s Disease Word List Registry Consortium1 (CERAD1) and CERAD.delay.recall scores than individuals with high TSH concentrations, and individuals with low FT4 concentrations had higher CERAD3 and Animal Fluency Test scores than individuals with high FT4 concentrations. Our results also showed a non-linear relationship between serum TSH and FT4 concentrations and the Animal Fluency Test. The TSH concentrations within the range of 1.703 to 3.145 mIU/L exhibit a positive correlation with Animal Fluency Test, whereas concentrations outside this range are negatively correlated with Animal Fluency Test. The FT4 concentrations exhibited a positive correlation with Animal Fluency Test to the left of the FT4 concentrations inflection point (0.849 ng/L), whereas to the right of this inflection point, correlation was negative. MR analysis results further indicate that genetic predisposition to hyperthyroidism may be associated with a reduced risk of dementia and vascular dementia(VaD). Conversely, genetic predisposition to hypothyroidism appears to be linked with an increased risk of dementia and VaD. Additionally, genetic predisposition to elevated TSH concentrations may be correlated with a heightened risk of risk of Alzheimer’s disease (AD).ConclusionThis study provides evidence of a nonlinear relationship between TSH and FT4 concentrations and cognitive function, with hyperthyroidism decreasing the risk of dementia and VaD, hypothyroidism increasing the risk of dementia and VaD, and elevated serum TSH concentrations increasing the risk of AD. Furthermore, prioritizing early detection, diagnosis, and treatment through the assessment of thyroid function in individuals at high risk for developing dementia is of paramount importance. This strategy has the potential to significantly contribute to the prevention and deceleration of dementia progression.