In the present study, a dispersive micro‐solid phase extraction method using magnetic graphene oxide/vancomycin nanocomposite as sorbent coupled with high‐performance liquid chromatography was developed for determining diazinon in water and food samples. The sorbent was characterized by various techniques such as Fourier‐transform infrared spectroscopy, X‐ray diffraction, scanning electron microscopy–energy dispersive spectroscopy, thermal gravimetric analysis, and Brunauer–Emmett–Teller surface area analysis. Influential parameters on the extraction efficiency of diazinon using dispersive micro‐solid phase extraction such as sorbent and its amount, elution solvent and its volume, adsorption and desorption times, and pH of sample solution were investigated and optimized. Under the optimized conditions, method detection limit and limit of quantitation values were 0.001 and 0.003 µg/mL, respectively. Relative recovery data for several real samples were obtained within the range of 85.0–102.0% with a relative standard deviation <7.5%. Intraday and interday relative standard deviation values were <5.2 and <7.5, respectively. The proposed method was successfully applied to quantitative determination of diazinon in several water and food samples.