Exploring efficient and stable electrocatalysts for the bifunctional oxygen evolution reaction (OER) and oxygen reduction reaction (ORR) is vital to developing renewable energy technologies. However, due to the substantial and intricate design space associated with these bifunctional OER/ORR electrocatalysts, their development presents a formidable challenge, resulting in their cost-prohibitive nature in both experimental and computational studies. Herein, using the defect physics method, we systematically investigate the formation energies and bifunctional overpotential (η Bi ) of 4d-transition-metal (4d-TM, 4d-TM = Zr, Nb, Mo, Ru, Rh, Pd, and Ag)-doped monolayer supercell g-C 3 N 4 (4d-TM@C 54 N 72 ) based on the density functional theory (DFT) calculations. Under N-rich and Crich conditions, we find that the formation energies of Rh N @C 54 N 71 (Rh occupation N) and Pd N @C 54 N 71 (Pd occupation N) are smaller than that of other 4d-TM N @C 54 N 71 (4d-TM occupation N site); for the 4d-TM int @C 54 N 72 (4d-TM interstitial site occupation), the lowest-formation energy defects are Pd int @C 54 N 72 . These results indicate that they have better stabilities. Interestingly, for these formation energy lower systems, Pd 0 int @C 54 N 72 (η Bi = 1.00 V) and Rh 1+ N @C 54 N 71 (η Bi = 0.73 V) have ultralow overpotential and can be great candidates for bifunctional OER/ORR electrocatalysts. We find the reason is that adjusting the charge states of 4d-TM@C 54 N 72 can tune the interaction strength between the oxygenated intermediates and the 4d-TM@ C 54 N 72 , which plays a crucial role in the activity of reactions. Additionally, the data obtained through machine learning (ML) application suggest that the electronegativity (N m ) and bond length of 4d-TM and coordination atoms (d TM-OOH ) are primary descriptors characterizing the OER and ORR activities, respectively. The charged defect tuning of the bifunctional OER/ORR activity for 4d-TM@C 54 N 72 would enable electrocatalytic performance optimization and the development of potential electrocatalysts for renewable energy applications.