The relationship between a pro‐inflammatory diet, assessed by the dietary inflammatory index (DII), and allergic diseases has attracted attention. However, the association between DII and immunoglobulin E (IgE) remains uncertain. We aim to investigate the association between energy‐adjusted DII (E‐DII) and total IgE. We analyzed data from the 2005 to 2006 National Health and Nutrition Examination Survey. The relationship between E‐DII and total IgE was assessed using linear regression and logistic regression analysis. Meanwhile, we conducted a subgroup analysis stratified by body mass index (BMI) and analyzed the mediating role of BMI. We included 3614 adult participants. After controlling for confounding factors, there was no statistical association between E‐DII and total IgE (β 0.023, 95% CI −0.01 to 0.057, p = .173) and the risk of high total IgE (OR 1.036, 95% CI 0.977 to 1.099, p = .233). We conducted subgroup analysis stratified by BMI. After controlling for confounding factors, only in overweight groups, E‐DII was statistically associated with total IgE (β 0.076, 95% CI 0.017 to 0.135, p = .012) and the risk of high total IgE (OR 1.124, 95% CI 1.015 to 1.246, p = .025). Generalized additive models and smooth curve fittings showed a positive linear relationship between E‐DII and total IgE in overweight participants. No statistical association was noted for the mediation effect of BMI on the association between E‐DII and total IgE in the overweight group (p = .23). Overweight participants with higher E‐DII were potentially at risk of elevated total IgE.