Accurate detection of pesticide residues in agricultural products is crucial for food safety and control strategies. Conventional chromatographic methods suffer from complex operation, high cost, and poor suitability for real-time monitoring. To overcome these limitations, this study investigates a low-cost approach integrating Visible-Near Infrared (Vis-NIR) reflectance spectroscopy with machine learning and deep learning algorithms to detect imidacloprid residues in spinach, and systematically evaluates 19 preprocessing pipelines to select the optimal strategy for different models. We acquired 1,600 Vis-NIR spectra from spinach leaves and applied 19 preprocessing pipelines, including interpolation, Savitzky–Golay (SG) smoothing, spectral derivative, wavelet-threshold denoising, and mean centering, to enhance signal quality and reduce noise. Three classification models—Support Vector Machine (SVM), Random Forest (RF), and 1D-Convolutional Neural Network (1D-CNN)—were developed using these datasets for comparative analysis. Under optimal preprocessing, SVM and RF achieved 99.27% accuracy, F1-scores above 0.9950, and AUC approaching 1.0. The 1D-CNN achieved 97.81% accuracy, F1-score of 0.9854, and AUC of 0.9940, but showed the lowest sensitivity to preprocessing variations (performance fluctuation of 1.29%) and higher confidence in identifying positive samples (0.7445). Overall, RF and SVM excel in simple classification, while 1D-CNN offers superior adaptability and generalization in spectral analysis.