ABSTRACT: Objective: To explore the relationship between dietary inflammatory index (DII) and heart failure (HF) in participants with cardiovascular and cerebrovascular diseases. Methods: NHANES (1998-2018) data were collected and used to assess the association of HF with DII. Twenty-four-hour dietary consumptions were used to calculate the scores of DII. Demographic characteristics and physical and laboratory examinations were collected for the comparison between HF and non-HF groups. Logistic regression analysis and random forest analysis were performed to calculate the odds rate and determine the potential beneficial dietary components in HF. Results: A total of 19,067 cardiac-cerebral vascular disease participants were categorized as HF (n = 1,382; 7.25%) and non-HF (n = 17,685; 92.75%) groups. Heart failure participants had higher levels of DII score compared with those in the non-HF group (0.239 ± 1.702 vs. -0.145 ± 1.704, p < 0.001). Compared with individuals with T1 (DII: -3.884 to -0.570) of DII, those in T3 (DII: 1.019 to 4.598) had a higher level of total cholesterol (4.49 ± 1.16 vs. 4.75 ± 1.28 mmol/L, p < 0.01), globulin (29.92 ± 5.37 vs. 31.29 ± 5.84 g/L, p < 0.001), and pulse rate (69.90 ± 12.22 vs. 72.22 ± 12.77, p < 0.001) and lower levels of albumin (40.76 ± 3.52 vs. 39.86 ± 3.83 g/L, p < 0.001), hemoglobin (13.76 ± 1.65 vs. 13.46 ± 1.77 g/dl, p < 0.05), and hematocrit (40.83 ± 4.69 vs. 40.17 ± 5.01%, p < 0.05). The odds rates of HF for DII from the logistic regression were 1.140, 1.158, and 1.110 in models 1, 2, and 3, respectively. In addition, from the results of random forest analysis, dietary magnesium, fiber, and beta carotene may be essential in HF. Conclusion: Dietary inflammatory index was positively associated with HF in US adults, and dietary intervention might be a promising method in the therapy of HF.