Compared to the traditional graphite anode, heteroatom-doped polymer carbon materials have high capacity retention due to their high porosity and porous structure. Therefore, they have great potential for application in lithium-ion battery (LIB) anodes. In this work,an N, P co-doped precursor polymer material (MBPp), synthesized via a one-pot method using bisphenol-A (C-source), melamine (N-source), and 9,10-Dihydro-9-oxa-10-phosphaphenanthrene-10-oxide (P-source). The resulting N, P-co-doped hard carbon materials (MBPs) were prepared at various pyrolysis temperatures, yielding microporous, mesoporous, and macroporous structures. MBP materials demonstrated excellent electrochemical performance as LIB anodes. Notably, MBP-900 achieved a reversible capacity of 262 mAh g-1 at 1000 mA g-1 (in 0.005-2.0 V voltage range) with a capacity retention rate of 97.2% after 1000 cycles. These findings highlight the significance of MBP materials, which possess numerous defects, large layer gaps, and excellent cycle stability, in advancing the development of polymer anode materials for LIBs.