Adsorption of dye molecules onto a sorbent can be an effective, low-cost method of decolorization of textile wastewater. Most of the techniques used for this aim were the high cost of production and the regeneration also makes them uneconomical. Molecular imprinting polymers are a new kind of materials which can be economical and effective adsorbents. In this study, a molecularly imprinted polymer (MIP) of textile dyes (Direct Red 23) was prepared for decolorization of textile wastewater and also used for leaching of this dye from the wastewater by adsorption of onto polymer. Acrylamide was used as a monomer and dimethyl sulfoxide was used as a porogen. The selective recognition ability of the MIP was studied by an equilibrium-adsorption batch method. The effective adsorption properties of the polymer were tested in synthetic dye wastewater. The high adsorption rate and the amount of imprinted dye that was removed from the polymer was nearly 65%. 80% of the dye was adsorbed by imprinted polymer in synthetic wastewater.