Abstract Molecularly imprinted polymers (MIPs) are a diverse class of materials designed for selective molecular recognition. These polymers are synthesized with particular binding sites that are suited to a target molecule or a collection of structurally similar molecules through the use of a process called molecular imprinting. MIPs were synthesized in this work to specifically remove direct violet 51 from occupational leachates and aqueous solutions. Methacrylic acid functioned as the functional monomer, ethylene glycol dimethacrylate (EGDMA) as the cross-linker, 2,2-azobisisobutyronitrile (AIBN) as the initiator, and alcohol as a porogenic solvent. To improve the dye removal effectiveness, a number of factors were optimized, including time, pH, analyte concentrations, and MIP/NIP dosages. The findings showed that MIPs had a much greater capacity for direct violet 51 adsorption than nonimprinted polymers (NIPs), with MIP adsorption capacity reaching 42.553 mg g−1 and NIP adsorption capacity reaching 7 mg g−1. The pseudo 2nd-order model described the adsorption kinetics, and the rate constant (K 2) for MIPs was found to be 0.00251 mg g−1 min. Furthermore, a high rebinding efficiency of 94 % was observed when the selectivity of MIPs for direct violet 51 was assessed against structurally similar templates.