A novel nitrogen-doped tantalum carbide (N-TaC) adsorbent was proposed for the efficient absorption and removal of carbamazepine (CBZ) from pharmaceutical wastewater. N-TaC exhibited an excellent specific surface area (SBET) of up to 201.7 m2 g−1, along with remarkable adsorption performance, including rich adsorption sites (∼ 119 mg g−1), rapid adsorption equilibrium (∼ 20 min), and effective removal of CBZ from aqueous solutions within a pH range of 212. The pseudo-first-order kinetic model best fit the adsorption kinetics (R2 > 0.999) at a high CBZ concentration. The fitting results of the intraparticle diffusion model determined that the intraparticle diffusion and boundary layer were the rate-limiting steps. The Liu isotherm model best fit the adsorption isotherm (R2 > 0.98), and the free energy E (0.455 kJ mol−1) of the DubininRadushkevich (D-R) isotherm model suggested that the adsorption type may be physical adsorption. The reaction was a spontaneous and exothermic process as determined by adsorption thermodynamic calculations. van der Waals forces were proposed as the main adsorption interactions. Furthermore, N-TaC exhibited excellent anti-interference to suspended solids in water, reusable stability (≥ 91% of adsorption capacity in 6 cycles), biofriendliness (96% 109.2% of E. coli survival rate), and expanded application in absorbing antibiotics (e.g., thiamphenicol), offering new perspectives for transition metal carbides (TMCs) as efficient sorbents in selective absorption drugs from pharmaceutical wastewater.