The frailty index based on laboratory tests (FI-lab) can identify individuals at increased risk for adverse health outcomes. The association between the FI-lab and all-cause mortality in patients with heart failure (HF) in the intensive care unit (ICU) remains unknown. This study aimed to determine the correlation between FI-lab and all-cause mortality to evaluate the impact of FI-lab on the prognosis of critically ill patients with HF. This retrospective observational study utilized data extracted from the Medical Information Mart for Intensive Care IV database. The FI-lab, which consists of 33 laboratory tests, was constructed. Patients were then grouped into quartiles (Q1-Q4) based on their FI-lab scores. Kaplan-Meier analysis was used to compare all-cause mortality among the four groups. A Cox proportional hazard analysis was conducted to examine the association between the FI-lab score and all-cause mortality. The incremental predictive value of adding FI-lab to classical disease severity scores was assessed using Harrell's C statistic, integrated discrimination improvement (IDI) and net reclassification improvement (NRI). Among 3021 patients, 838 (27.74%) died within 28days, and 1400 (46.34%) died within a 360day follow-up period. Kaplan-Meier analysis indicated that patients with higher FI-lab scores had significantly higher risks of all-cause mortality (log-rank P<0.001). Multivariable Cox regression suggested that FI-lab, evaluated as a continuous variable (for each 0.01 increase), was associated with increased 28day mortality [hazard ratio (HR) 1.02, 95% confidence interval (CI) (1.01-1.03), P<0.001] and 360day mortality [HR 1.02, 95% CI (1.01-1.02), P<0.001]. When assessed in quartiles, the 28day mortality risk [HR 1.66, 95% CI (1.28-2.15), P<0.001] and 360day mortality risk [HR 1.48, 95% CI (1.23-1.8), P<0.001] were significantly higher for FI-lab Q4 compared with FI-lab Q1. FI-lab significantly improved the predictive capability of classical disease severity scores for 28 and 360day mortality. In ICU patients diagnosed with HF, the FI-lab is a potent predictor of short-term and long-term mortality in critically ill patients with HF. The active use of FI-lab to identify high-risk groups among critically ill HF patients and initiate timely interventions may have significant value in improving the prognosis of critically ill patients with HF.