This study aimed to explore the association of carbohydrate to fiber ratio (CFR) with metabolic dysfunction-associated fatty liver disease (MAFLD) in adults. In this study, data from the 2 cycles (2017–2018 and 2019–2020) of the NHANES were used. Univariate and multivariate weighted logistic regression analyses were applied to evaluate the association between CFR and MAFLD. Odds ratios (ORs) and 95% confidence levels (CIs) were estimated. Subgroup analysis was further performed in terms of gender, age and comorbidity (diabetes, hypertension). A total of 3180 individuals were included, with 1408 (44.28%) in the non-MAFLD group and 1772 (55.72%) in the MAFLD group. After adjusting different variables, a dietary fiber intake of 11.15–18.40 g was associated with significantly lower odds of MAFLD compared with a fiber intake < 11.15 g (OR = 0.71, 95% CI 0.54–0.93). In contrast to a dietary CFR < 12.58, a CFR > 19.91 was associated with significantly higher odds of MAFLD (OR = 1.57, 95% CI 1.09–2.27). Compared with females with a dietary CFR < 12.58, those with a CFR > 19.91 had significantly increased odds of MAFLD (OR = 1.87, 95% CI 1.29–2.73). Among individuals aged < 65 years, a dietary CFR > 19.91 was associated with higher odds of MAFLD than a dietary CFR < 12.58 (OR = 1.52, 95% CI 1.02–2.25). For participants without diabetes (OR = 1.79, 95% CI 1.26–2.54) or hypertension (OR = 1.93, 95% CI 1.02–3.65), a dietary CFR > 19.91 was associated with elevated odds of MAFLD than a CFR < 12.58. In summary, a higher CFR was associated with significantly greater odds of MAFLD, indicating the negative association between carbohydrate quality and MAFLD. The research would be conducive to metabolic dysfunction-associated fatty liver disease treatment.