Soil organic carbon (SOC) is the principal factor contributing to enhanced soil fertility and also functions as the major carbon sink within terrestrial ecosystems. Applying fertilizer is a crucial agricultural practice that enhances SOC and promotes crop yields. Nevertheless, the response of SOC, active organic carbon fraction and hay yield to nitrogen and phosphorus application is still unclear. The objective of this study was to investigate the impact of nitrogen-phosphorus interactions on SOC, active organic carbon fractions and hay yield in alfalfa fields. A two-factor randomized group design was employed in this study, with two nitrogen levels of 0 kg·ha-1 (N0) and 120 kg·ha-1 (N1) and four phosphorus levels of 0 kg·ha-1 (P0), 50 kg·ha-1 (P1), 100 kg·ha-1 (P2) and 150 kg·ha-1 (P3). The results showed that the nitrogen and phosphorus treatments increased SOC, easily oxidized organic carbon (EOC), dissolved organic carbon (DOC), particulate organic carbon (POC), microbial biomass carbon (MBC) and hay yield in alfalfa fields, and increased with the duration of fertilizer application, reaching a maximum under N1P2 or N1P3 treatments. The increases in SOC, EOC, DOC, POC, MBC content and hay yield in the 0–60 cm soil layer of the alfalfa field were 9.11%-21.85%, 1.07%-25.01%, 6.94%-22.03%, 10.36%-44.15%, 26.46%-62.61% and 5.51%-23.25% for the nitrogen and phosphorus treatments, respectively. The vertical distribution of SOC, EOC, DOC and POC contents under all nitrogen and phosphorus treatments was highest in the 0–20 cm soil layer and tended to decrease with increasing depth of the soil layer. The MBC content was highest in the 10–30 cm soil layer. DOC/SOC, MBC/SOC (excluding N0P1 treatment) and POC/SOC were all higher in the 0–40 cm soil layer of the alfalfa field compared to the N0P0 treatment, indicating that the nitrogen and phosphorus treatments effectively improved soil fertility, while EOC/SOC and DOC/SOC were both lower in the 40–60 cm soil layer than in the N0P0 treatment, indicating that the nitrogen and phosphorus treatments improved soil carbon sequestration potential. The soil layer between 0-30 cm exhibited the highest sensitivity index for MBC, whereas the soil layer between 30-60 cm had the highest sensitivity index for POC. This suggests that the indication for changes in SOC due to nitrogen and phosphorus treatment shifted from MBC to POC as the soil depth increased. Meanwhile, except the 20–30 cm layer of soil in the N0P1 treatment and the 20–50 cm layer in the N1P0 treatment, all fertilizers enhanced the soil Carbon management index (CMI) to varying degrees. Structural equation modeling shows that nitrogen and phosphorus indirectly affect SOC content by changing the content of the active organic carbon fraction, and that SOC is primarily impacted by POC and MBC. The comprehensive assessment indicated that the N1P2 treatment was the optimal fertilizer application pattern. In summary, the nitrogen and phosphorus treatments improved soil fertility in the 0–40 cm soil layer and soil carbon sequestration potential in the 40–60 cm soil layer of alfalfa fields. In agroecosystems, a recommended application rate of 120 kg·ha-1 for nitrogen and 100 kg·ha-1 for phosphorus is the most effective in increasing SOC content, soil carbon pool potential and alfalfa hay yield.