Objective To investigate the protective effect of Xuebijing Injection on ischemia⁃reperfusion injury in isolated beating pig hearts. Methods Twelve Bama miniature pigs were randomly divided into Xuebijing group or normal saline group, with 6 pigs in each group. The hearts of miniature pigs in the Xuebijing group and the normal saline group were excised, and the isolated pig hearts were connected to an extracorporeal membrane oxygenator circuit (10 mL of Xuebijing Injection and 10 mL of normal saline were added to the prime solution in the Xuebijing group and the normal saline group, respectively). The heart rate, perfusion pressure, perfusion flow rate, blood temperature, and perfusion speed at the heart recovery time (T0) and the 8th hour of cardiopulmonary bypass (T8) were recorded. Myocardial tissue was collected at T8 for HE staining. At T0, the 2nd hour (T2), 4th hour (T4), 6th hour (T6) of cardiopulmonary bypass, and T8, prothrombin time (PT), activated partial thromboplastin time (APTT), thrombin time (TT), fibrinogen (FIB), D⁃dimer, as well as levels of interleukin (IL)⁃6, IL⁃10, and tumor necrosis factor α (TNF⁃α) were measured. Myocardial tissue was collected at T0, T4, and T8, and the protein and mRNA expressions of tumor protein p53, solute carrier family 7 member 11 (SLC7A11), and glutathione peroxidase 4 (GPX4) were detected by Western blot and real⁃time fluorescence quantitative PCR. Results There was no statistically significant difference in heart rate, perfusion pressure, perfusion flow rate, blood temperature, perfusion speed, or heart recovery time during the 8⁃hour cardiopulmonary bypass in isolated pig hearts between the two groups (P>0.05). HE staining revealed that the degree of myocardial injury at T8 was milder in the Xuebijing group than in the normal saline group. At T0, there was no statistically significant difference in APTT and TT between the Xuebijing group and the normal saline group (P>0.05). During cardiopulmonary bypass, heparinization exhibited a favorable effect in both groups. At T0, T2, and T4, PT in the Xuebijing group was shorter than that in the normal saline group (P<0.05). At T4, T6, and T8, FIB level in the Xuebijing group was higher than that in the normal saline group (P<0.05). At T2 and T6, D⁃dimer level in the Xuebijing group was lower than that in the normal saline group (P<0.05). At T2, T4, T6, and T8, IL⁃6 level in the Xuebijing group was lower than that in the normal saline group (P<0.05). At T4, T6, and T8, TNF⁃α level in the Xuebijing group was lower than that in the normal saline group, while IL⁃10 level was higher than that in the normal saline group (P<0.05). At T4 and T8, the protein and mRNA expressions of p53 in the Xuebijing group were lower than those in the normal saline group, while the protein and mRNA expressions of SLC7A11 and GPX4 were higher than those in the normal saline group (P<0.05). Conclusion Under ex vivo perfusion with donor blood, Xuebijing Injection can improve coagulation function, reduce inflammatory response, and inhibit ferroptosis⁃related oxidative damage, thereby alleviating ischemia⁃reperfusion injury in isolated beating pig hearts.