This study aimed to develop and validate distinct nomogram models for assessing CVD risk in individuals with prediabetes and diabetes. In a cross-sectional study design, we examined data from 2294 prediabetes and 1037 diabetics who participated in the National Health and Nutrition Examination Survey, which was conducted in the United States of America between 2007 and 2018. The dataset was randomly divided into training and validation cohorts at a ratio of 0.75-0.25. The Boruta feature selection method was used in the training cohort to identify optimal predictors for CVD diagnosis. A web-based dynamic nomogram was developed using the selected features, which were validated in the validation cohort. The Hosmer-Lemeshow test was performed to assess the nomogram’s stability and performance. Receiver operating characteristics and calibration curves were used to assess the effectiveness of the nomogram. The clinical applicability of the nomogram was evaluated using decision curve analysis and clinical impact curves. In the prediabetes cohort, the CVD risk prediction nomogram included nine risk factors: age, smoking status, platelet/lymphocyte ratio, platelet count, white blood cell count, red cell distribution width, lactate dehydrogenase level, sleep disorder, and hypertension. In the diabetes cohort, the CVD risk prediction nomogram included eleven risk factors: age, material status, smoking status, systemic inflammatory response index, neutrophil-to-lymphocyte ratio, red cell distribution width, lactate dehydrogenase, high-density lipoprotein cholesterol, sleep disorder, hypertension, and physical activity. The nomogram models developed in this study have good predictive and discriminant utility for predicting CVD risk in patients with prediabetes and diabetes.© 2024. The Author(s).