The response mechanism of microorganisms in partial denitrification (PD) system under antibiotic stress, particularly microbial energy metabolism and electron transfer, remain inadequately understood. This knowledge gap hinders the establishment of ecological links between microbial dynamics and macro-level reactor performance. To address this, moving bed biofilm reactors were employed to investigate the dynamic changes of microbial community and metabolism under sulfadiazine (SDZ) and ciprofloxacin (CIP) stress. Results showed that dosing 2 mg/L SDZ or CIP accelerated nitrite accumulation, achieving this milestone 15 days earlier than in the control group. At the end of the operational phase, nitrate removal efficiencies reached 90.3 ± 18.3 % (Control), 83.5 ± 16.2 % (SDZ-treated) and 93.9 ± 12.4 % (CIP-treated), with nitrate-to nitrite-transformation rates of 61.3 ± 12.7 %, 65.6 ± 13.1 % and 58.0 ± 21.2 %, respectively. The abundances of energy supply related genes, i.e., sucC and PK were higher in the CIP-treated group, while those in the other two groups were similar. The promoted tricarboxylic acid cycle and glycolysis led to NADH and ATP accumulation, accelerating nitrogen metabolism and benefiting early nitrite accumulation in the antibiotic-stressed system. More importantly, increasing antibiotics concentration from 2 mg/L to 4 mg/L induced selective migration of Thauera from floc to biofilm (abundance in floc reduced to < 2.01 %). Metagenomic sequencing indicated that the higher abundance of narGHI in biofilms, compared to flocs, was crucial for maintaining stable PD performance under antibiotic stress. The electron transport related genes, such as IDH1, DLD and DLAT, were more abundant in biofilms than in flocs after SDZ and CIP addition. These findings provide a theoretical basis for understanding the response mechanism of PD consortia to antibiotic.