Sulfonate esters, one class of genotoxic impurities (GTIs), have gained significant attention in recent years due to their potential to cause genetic mutations and cancer. In the current study, we employed the dummy template molecular imprinting technology with a dummy template molecule replacing the target molecule to establish a pretreatment method for samples containing p-toluene sulfonate esters. Through computer simulation and ultraviolet-visible spectroscopy analysis, the optimal functional monomer acrylamide and polymerization solvent chloroform were selected. Subsequently, a dummy template molecularly imprinted polymer (DMIP) was prepared by the precipitation polymerization method, and the polymer was characterized in morphology, particle size, and composition. The results of the adsorption and enrichment study demonstrated that the DMIP has high adsorption capability (Q = 7.88 mg/g) and favorable imprinting effects (IF = 1.37); Further, it could simultaneously adsorb three p-toluene sulfonate esters. The optimal adsorption conditions were obtained by conditional optimization of solid-phase extraction (SPE). A pH 7 solution was selected as the loading condition, the methanol/1 % phosphoric acid solution (20:80, v/v) was selected as the washing solution, and acetonitrile containing 10 % acetic acid in 6 mL was selected as the elution solvent. Finally, we determined methyl p-toluene sulfonate alkyl esters, ethyl p-toluene sulfonate alkyl esters, and isopropyl p-toluene sulfonate alkyl esters in tosufloxacin toluene sulfonate and capecitabine at the 10 ppm level (relative to 1 mg/mL active pharmaceutical ingredient (API) samples) by using DMIP-based SPE coupled with HPLC. This approach facilitated the selective enrichment of p-toluene sulfonate esters GTIs from complex API samples.