This study aimed to investigate the specific adsorption of heroin made from morphine that extracted opium. Using acrylamide and n-iso propyiacrylamide as the functional monomers, n,n′-methylenebisacrylamide as the crosslinker, and benzoyl peroxide as the initiator. At bulk heroin concentrations of 20, 40, 60, 80, and 100 ppm in ethanol solution, this MIP's maximum heroin adsorption capacity of 3.87 mg/g at used 0.2 gm acrylamide as monomer which was among the best capacities documented in the literature to date. The adsorption capacity, selectivity separation, reusability, and chemical stabilities of the molecularly imprinted polymers were confirmed by thermodynamic analysis, experimental characterization, adsorption investigations, and recommended protocols. FTIR, UV-vis, and scanning electron microscopy were used to observe the analytes. Three measurements taken during two patient repeat tests at 20–100 ppm of heroin have relative standard deviations (RSD%) ranging from 1.94% to 4.27%. In human urine samples that were tampered with, the relative recoveries for heroin range from 92.5 to 103.75%.