Prediabetes is an early phase before diabetes. Diabetes and dietary inflammation are two crucial factors that are strongly associated with cardiovascular diseases (CVDs). Dietary interventions slowed the progression of diabetes and CVD. However, the associations between CVDs and dietary inflammation in different stages of pathoglycaemia have not been investigated. To explore the effect of a proinflammatory diet on CVD incidence at different stages of diabetes, NHANES (2001–2018) data were collected and analysed. A total of 3137 CVD patients with a comparable non-CVD group (n = 3137) were enrolled after propensity score matching (PSM) analysis. These patients were subsequently categorized into three subgroups: those with diabetes (n = 3043), those with prediabetes (n = 1099) and those with normoglycemia (n = 2132). The DII (Dietary inflammatory index) is a risk factor for CVD, both in overall individuals and in each subgroup of population-based information. In diabetic individuals, the odds ratios (ORs) (95% CIs) of CVD incidence for the DII were 1.10 (1.05, 1.15) and 1.08 (1.03, 1.13) according to the crude and adjusted models, respectively. For individuals with prediabetes, the ORs (95% CIs) of CVD risk for DII were 1.05 (0.97, 1.14) and 1.11 (1.01, 1.22) according to the crude and adjusted models, respectively. After adjusting for population-based information and hypertension status, the DII appeared to have the highest OR for individuals with prediabetes, and no significant association was found between the DII score and CVD risk in the normoglycemia group. Moreover, the OR of CVD for DII in the uncontrolled diabetes group was 1.06 (0.98, 1.16)*. These results suggest that the DII is more closely associated with the risk of CVDs in prediabetic and diabetic populations, and we should pay more attention to diet control before a person develops diabetes to prevent CVD progression.