In this study, flame retardant polyurethane rigid foam was prepared by incorporating 15 wt% ammonium polyphosphate (APP) and ionic liquid (1-butyl-2,3-dimethylimidazolium tetrafluoroborate, abbreviated as B4F). The flame retardant and thermal stability of the material were evaluated using vertical combustion (UL-94), limiting oxygen index (LOI), cone calorimeter (CONE), and thermogravimetric analyzer (TG) tests. Additionally, scanning electron microscopy (SEM), Raman spectroscopy (Raman), and X-ray photoelectron spectroscopy (XPS) were utilized to explore the flame retardancy mechanism in the carbon layer after combustion. The experimental results showed that the addition of 1 wt%B4F and 14 wt% APP to the polyurethane (RPUF/14APP/1B4F) significantly improved the vertical combustion test, upgrading it from the V-1 level to the V-0 level. This improvement was attributed to the increased degree of graphitization of the material, as evidenced by the reduced ratio of amorphous carbon to graphitic carbon (ID/IG) from 2.68 to 1.38. XPS analysis revealed that RPUF/14APP/1B4F exhibited a higher C/O ratio in the residual carbon (3.03) compared to RPUF/15APP (1.84), indicating that B4F effectively enhanced the antioxidant properties of the flame-retardant materials. Under the air atmosphere, RPUF/14APP/1B4F demonstrated an increased char formation at 800 °C (21.24 %), which was 71.01 % higher than RPUF/15APP. The interaction between B4F and APP led to the formation of a more stable char layer structure in polyurethane, further enhancing its flame retardancy. In conclusion, the RPUF/14APP/1B4F demonstrated a synergistic flame retardancy effect and enhanced thermal stability. The addition of B4F improved the graphitization degree of the material and increased the C/O ratio in the residual carbon, enhancing the antioxidant properties of the system. Moreover, the interaction between B4F and APP promoted the formation of a more stable char layer, effectively improving the flame retardant properties of the polyurethane. These findings provide valuable insights for the development of advanced flame retardant polyurethane materials with improved fire safety in various applications.