In conclusion, our results suggest that the methylation levels of the CYP24A1, CYP27A1, CYP27B1, CYP2R1, and VDR genes in the metabolic pathway of vitamin D are related to the risk and prognosis of TB. Here, CYP24A1 is linked to tuberculosis.