Solid phase extraction (SPE) is regarded as the most effective purification method for complex matrix samples owing to its simplicity of operator, time-saving, high accuracy, and environmental friendliness. SPE technology is still affected by the high cost of commercial SPE columns and poor adsorption selectivity. Hence, the development of low-cost and highly selective adsorbents is quite challenging and demanding in SPE. In this study, a novel 3DG functionalized magnetic solid phase extraction materials was prepared based on “thiol-ene” click chemistry. The structure, morphology, thermal stability, and magnetic properties of the magnetic composites were studied by Fourier transform infrared spectroscopy (FT-IR), scanning electron microscopy (SEM), energy dispersive spectroscopy (EDS), thermogravimetric analysis (TGA), and vibrating sample magnetometer (VSM). Then the adsorption performance of composite was determined by static adsorption experiments, which showed fast binding kinetics (100 min) and good adsorption performance (Qe = 65.34 mg/g). Moreover, these magnetic nanoparticles were used as adsorbents for magnetic solid phase extraction (MSPE) and coupled with high-performance liquid chromatography (HPLC) for separation and detection of illegally added hexamethylenetetramine in vermicelli. As for practical application, the recoveries for the spiked samples in the concentration range of 8–40 μg/g were between 83.24–92.69%, and the RSD was between 0.20–2.07%.