We aimed to investigate sex-specific associations between cardiovascular risk factors and atherosclerotic cardiovascular disease (ASCVD) risk using machine learning. We studied 258,279 individuals (132,505 [51.3%] men and 125,774 [48.7%] women) without documented ASCVD who underwent national health screening. A random forest model was developed using 16 variables to predict the 10-year ASCVD in each sex. The association between cardiovascular risk factors and 10-year ASCVD probabilities was examined using partial dependency plots. During the 10-year follow-up, 12,319 (4.8%) individuals developed ASCVD, with a higher incidence in men than in women (5.3% vs. 4.2%,P< 0.001). The performance of the random forest model was similar to that of the pooled cohort equations (area under the receiver operating characteristic curve, men: 0.733 vs. 0.727; women: 0.769 vs. 0.762). Age and body mass index were the two most important predictors in the random forest model for both sexes. In partial dependency plots, advanced age and increased waist circumference were more strongly associated with higher probabilities of ASCVD in women. In contrast, ASCVD probabilities increased more steeply with higher total cholesterol and low-density lipoprotein (LDL) cholesterol levels in men. These sex-specific associations were verified in the conventional Cox analyses. In conclusion, there were significant sex differences in the association between cardiovascular risk factors and ASCVD events. While higher total cholesterol or LDL cholesterol levels were more strongly associated with the risk of ASCVD in men, older age and increased waist circumference were more strongly associated with the risk of ASCVD in women.