PurposeSpecific nutrients found in food, such as minerals, antioxidants, and macronutrients, have a significant impact on immune function and human health. However, there is currently limited research exploring the relationship between specific nutrients, immune system function, and thyroid dysfunction commonly observed in autoimmune thyroid diseases, which manifest predominantly as hyperthyroidism or hypothyroidism. Therefore, the objective of this study was to investigate the connections between dietary traits and thyroid dysfunction, as well as the potential mediating role of immune cells, using Mendelian randomization (MR) analysis.MethodsThe two-step MR analysis used single-nucleotide polymorphisms as instruments, with a threshold of p < 5e−08 for nutrients and thyroid dysfunction, and p < 5e−06 for immune cells. Data from different GWAS databases and UK Biobank were combined to analyze 8 antioxidants and 7 minerals, while the data for 4 macronutrients came from a cohort of 235,000 individuals of European. The outcome data (hypothyroidism, N = 3340; hyperthyroidism, N = 1840; free thyroxin [FT4], N = 49,269; thyroid-stimulating hormone [TSH], N = 54,288) were source from the ThyroidOmics consortium. Immune trait data, including 731 immune phenotypes, were collected from the GWAS catalog.ResultsThe results revealed that nutrient changes, such as lycopene, toenail and blood selenium, and α-tocopherol, impacted the immune system. Immune cells also affected thyroid function, with cDC cells promoting hypothyroidism and median fluorescence intensity (MFI) phenotypes correlating strongly with FT4 levels. Toenail and blood selenium reduce the relative cell counts (RCC) phenotypes of immune cells (CD62L− plasmacytoid DC %DC and transitional B cells %Lymphocyte), thereby diminishing its promoting effect on hypothyroidis. Furthermore, toenail and blood selenium mainly impacted phenotypes in three types of T cells (CD25 + + CD8br, CD3 on CD45RA− CD4+, and CD45RA on Terminally Differentiated CD8br), reinforcing the negative regulation of FT4 levels.ConclusionThe role of immune cells as mediators in the relationship between nutrients and thyroid dysfunction highlights their potential as diagnostic or therapeutic markers. Toenail and blood selenium levels can indirectly impact hypothyroidism by influencing the RCC levels of two types of immune cells, and can indirectly affect FT4 levels by influencing three types of T cells.