Anemia is common in patients with rheumatoid arthritis (RA), and it is unknown whether the dietary inflammatory index (DII) is linked to anemia. This study aimed to clarify the prevalence of anemia in RA patients and its association with the DII. The data utilized in this study were collected from the National Health and Nutrition Examination Survey database from 1999 to 2018. The prevalence of anemia in RA patients was estimated by ethnicity, sex, and age. Weighted multivariate logistic regression was utilized to explore the correlation between anemia risk and DII. The most crucial dietary factors related to the risk of anemia in RA patients were screened by stepwise regression. A nomogram model was established according to key dietary factors. A total of 10.25% (confidence interval, 8.58–11.92%) of RA patients will develop anemia, with the lowest prevalence around the age of 60. In addition, higher DII levels were discovered in anemic patients than in nonanemic patients. In multivariate regression models, an important positive association was revealed between anemia and growing quartiles of DII (Q4 vs Q1: odds ratio = 1.98; confidence interval, 1.25–3.15). In the subgroup analysis, the adjusted relation of DII with anemia in females, Mexicans, smokers, nondrinkers, and age groups ≥ 60 years was statistically significant. The same association was observed in the sensitivity analysis. A nomogram model based on stepwise regression screening of key dietary factors showed good discriminatory power to identify anemic risk in RA patients (area under the curve: 0.707). In patients with RA, high DII levels were associated with the risk of anemia. More attention should be given to controlling dietary inflammation to better prevent and treat anemia.