BackgroundMany studies have reported the link between gut microbiota and thyroid dysfunction. However, the causal effect of gut microbiota on thyroid dysfunction and the changes in gut microbiota after the onset of thyroid dysfunction are not clear.MethodsA two-sample Mendelian randomization (MR) study was used to explore the complex relationship between gut microbiota and thyroid dysfunction. Data on 211 bacterial taxa were obtained from the MiBioGen consortium, and data on thyroid dysfunction, including hypothyroidism, thyroid-stimulating hormone alteration, thyroxine deficiency, and thyroid peroxidase antibodies positivity, were derived from several databases. Inverse variance weighting (IVW), weighted median, MR-Egger, weighted mode, and simple mode were applied to assess the causal effects of gut microbiota on thyroid dysfunction. Comprehensive sensitivity analyses were followed to validate the robustness of the results. Finally, a reverse MR study was conducted to explore the alteration of gut microbiota after hypothyroidism onset.ResultsOur bidirectional two-sample MR study revealed that the genera Intestinimonas, Eubacterium brachy group, Ruminiclostridium5, and Ruminococcaceae UCG004 were the risk factors for decreased thyroid function, whereas the genera Bifidobacterium and Lachnospiraceae UCG008 and phyla Actinobacteria and Verrucomicrobia were protective. The abundance of eight bacterial taxa varied after the onset of hypothyroidism. Sensitivity analysis showed that no heterogeneity or pleiotropy existed in the results of this study.ConclusionThis novel MR study systematically demonstrated the complex relationship between gut microbiota and thyroid dysfunction, which supports the selection of more targeted probiotics to maintain thyroid–gut axis homeostasis and thus to prevent, control, and reverse the development of thyroid dysfunction.