Background: Epigenome-wide association studies identified the cg00574958 DNA methylation site at the carnitine palmitoyltransferase-1A (CPT1A) gene to be associated with reduced risk of metabolic diseases (hypertriglyceridemia, obesity, type 2 diabetes, hypertension, metabolic syndrome), but the mechanism underlying these associations is unknown. Objectives: We aimed to elucidate whether carbohydrate and fat intakes modulate cg00574958 methylation and the risk of metabolic diseases. Methods: We examined associations between carbohydrate (CHO) and fat (FAT) intake, as percentages of total diet energy, and the CHO/FAT ratio with CPT1A-cg00574958, and the risk of metabolic diseases in 3 populations (Genetics of Lipid Lowering Drugs and Diet Network, n = 978; Framingham Heart Study, n = 2331; and REgistre GIroní del COR study, n = 645) while adjusting for confounding factors. To understand possible causal effects of dietary intake on the risk of metabolic diseases, we performed meta-analysis, CPT1A transcription analysis, and mediation analysis with CHO and FAT intakes as exposures and cg00574958 methylation as the mediator. Results: We confirmed strong associations of cg00574958 methylation with metabolic phenotypes (BMI, triglyceride, glucose) and diseases in all 3 populations. Our results showed that CHO intake and CHO/FAT ratio were positively associated with cg00574958 methylation, whereas FAT intake was negatively correlated with cg00574958 methylation. Meta-analysis further confirmed this strong correlation, with β = 58.4 ± 7.27, P = 8.98 x 10-16 for CHO intake; β = -36.4 ± 5.95, P = 9.96 x 10-10 for FAT intake; and β = 3.30 ± 0.49, P = 1.48 x 10-11 for the CHO/FAT ratio. Furthermore, CPT1A mRNA expression was negatively associated with CHO intake, and positively associated with FAT intake, and metabolic phenotypes. Mediation analysis supports the hypothesis that CHO intake induces CPT1A methylation, hence reducing the risk of metabolic diseases, whereas FAT intake inhibits CPT1A methylation, thereby increasing the risk of metabolic diseases. Conclusions: Our results suggest that the proportion of total energy supplied by CHO and FAT can have a causal effect on the risk of metabolic diseases via the epigenetic status of CPT1A. Study registration at https://www.clinicaltrials.gov/: the Genetics of Lipid Lowering Drugs and Diet Network (GOLDN) - NCT01023750; and the Framingham Heart Study (FHS) - NCT00005121.