Erectile dysfunction(ED), a prevalent condition within the male genitourinary system, significantly impairs the quality of life for affected men. Although certain inflammatory indicators, such as the neutrophil-to-lymphocyte ratio(NLR), systemic inflammatory response index (SIRI), and systemic immune-inflammation index(SII), have been linked to ED, the correlation with other markers and their impact on survival outcomes in ED patients remain largely unexplored. This research aims to investigate the correlation between inflammatory biomarkers derived from a complete blood cell count(CBC) and the occurrence of ED. Data regarding ED were extracted from the 2001–2004 National Health and Nutrition Examination Survey(NHANES), and mortality events were ascertained through the National Death Index up to December 2019. The CBC-derived inflammatory indicators assessed in this study included the NLR, derived neutrophil-to-lymphocyte ratio(dNLR), monocyte-to-lymphocyte ratio(MLR), neutrophil-monocyte to lymphocyte ratio (NMLR), SIRI, and SII. The prognostic significance of these CBC-derived inflammatory indicators was evaluated using random survival forests(RSF) analysis. Our study encompassed a cohort of 3,639 individuals, among whom 1,031 were diagnosed with ED. Among individuals with ED, 610 experienced all-cause mortality. Following adjustment for all confounding variables, it was observed that elevated levels of NLR(OR = 1.09, 95%CI 1.00–1.19,
p
= 0.021), MLR (OR = 2.97, 95% CI 1.18–7.50,
p
= 0.01), NMLR(OR = 1.10, 95% CI 1.01–1.11,
p
= 0.006), and SIRI(OR = 1.11, 95% CI 1.01–1.22,
p
= 0.017) were associated with an increased prevalence of ED. Among participants with ED, those in the highest quartile of NLR(HR = 1.06, 95% CI 1.00–1.11,
p
= 0.032), MLR(HR = 2.00, 95% CI 1.33–3.01,
p
< 0.001), NMLR (HR = 1.06, 95% CI 1.01–1.11,
p
= 0.024), and SII(HR = 1.00, 95% CI 1.00–1.00,
p
= 0.015) exhibited an elevated risk of all-cause mortality compared to those in the lower levels of inflammation-derived indicators. Our research suggests that, compared with other inflammatory markers derived from complete blood cell count, MLR has the highest predictive power for the prevalence of ED and all-cause mortality in these populations.