In this study, melatonin (MLT)-imprinted poly (ethylene glycol dimethacrylate-N-methacryloyl-L-tryptophan methyl ester) [MLT-PEMATrp] microbeads were prepared for solid phase extraction (SPE) of melatonin (MLT) from edible plants prior to high performance liquid chromatography (HPLC) analysis. The microbeads were prepared via molecular imprinting technique by using MLT as a template. The MLT-PEMATrp microbeads were characterized by using Fourier transform infrared spectroscopy (FTIR), scanning electron microscopy (SEM), thermal gravimetic analysis (TGA), N2 adsorption/desorption isotherms and swelling test. The parameters such as adsorption time, temperature, adsorbent amount, pH and ionic strength were detailedly optimized to increase the effciency of MLT adsorption procedure. The adsorption properties of MLT onto the MLT-PEMATrp microbeads (MIP) and non-imprinted PEMATrp microbeads (NIP) were investigated to show the effectiveness of imprinting. MIP showed higher adsorption capacity for MLT (QMIP = 207.71 mg g-1) than NIP (QNIP = 12.15 mg g-1). The relative selectivity coefficients calculated for serotonin (3.41) and L-tryptophan (5.94) indicated that MLT-PEMATrp microbeads exhibit significantly high selectivity for MLT. The microbeads were used for SPE of MLT from Linden (Tilia tomentosa), fennel (Foeniculum Vulgare), sage (Salvia officinalis) and chamomilla (Matricaria chamomilla) samples prior to HPLC analysis. The recoveries of MLT in the samples were in the range of 90-103.4%. The SPE method had a limit of detection (LOD) in the range of 0.026-0.094 mu g mL-1. The MLTPEMATrp microbeads was very effective for SPE of MLT.