Metabolic dysfunction-associated steatotic liver disease (MASLD) has emerged as a predominant liver disease worldwide, lacking approved drugs for clinical intervention at present. The composite dietary antioxidant index (CDAI) is used to assess the anti-inflammatory properties of diets, with higher CDAI indicating greater exposure to antioxidants. Therefore, our study aimed to explore the relationship between CDAI and MASLD in order to identify potential therapeutic approaches. We collected data from 12,286 participants in the National Health and Nutrition Examination Survey (NHANES) database from 2017 to 2020 for analysis. The correlation between CDAI and MASLD status, controlled attenuation parameter (CAP), and liver stiffness measurement (LSM) was evaluated by adjusting for confounding variables using weighted binary logistic regression model, linear regression model, and restricted cubic spline (RCS) regression. The median CDAI in this study was − 0.3055 (interquartile range [IQR], − 2.299 to 2.290). The CDAI was higher in the population characterized by being young, female, higher income, absence of diabetes, and non-MASLD. After multivariable adjustment, the results of the weighted linear regression model suggested that higher CDAI may be associated with a decrease in CAP values; the results of the RCS regression model indicated significant non-linear relationships between MASLD status, CAP, LSM, and CDAI. The CDAI corresponding to the inflection points of the relationship curves between MASLD status, CAP, LSM, and CDAI were 0.349, 0.699, and 0.174, respectively. After further stratification by gender, we found that the relationship between MASLD status, CAP, and CDAI was significantly linear for females, whereas for males, it was non-linear, and the CDAI values corresponding to the inflection points in the curves for males were 1.325 and 0.985, respectively. We found that higher CDAI may be associated with decreased CAP values, particularly significant in females, suggesting that the intake of complex dietary antioxidants may ameliorate hepatic steatosis and reduce the occurrence of MASLD. Therefore, promoting dietary patterns rich in antioxidants may be an appropriate strategy to reduce the incidence of MASLD.