In this study, we critically evaluated the performance of an emerging technology, hyperspectral imaging (HSI), for detecting microplastics (MPs) in soil. We examined the technology's robustness against varying environmental conditions in five groups of experiments. Our findings show that near-infrared (NIR) hyperspectral imaging (HSI) effectively detects microplastics (MPs) in soil, though detection efficacy is influenced by factors such as MP concentration, color, and soil moisture. We found a generally linear relationship between the levels of MPs in various soils and their spectral responses in the NIR HSI imaging spectrum. However, effectiveness is reduced for certain MPs, like polyethylene, in kaolinite clay. Furthermore, we showed that soil moisture considerably influenced the detection of MPs, leading to nonlinearities in quantification and adding complexities to spectral analysis. The varied responses of MPs of different sizes and colors to NIR HSI present further challenges in detection and quantification. The research suggests pre-grouping of MPs based on size before analysis and proposes further investigation into the interaction between soil moisture and MP detectability to enhance HSI's application in MP monitoring and quantification. To our knowledge, this study is the first to comprehensively evaluate this technology for detecting and quantifying microplastics.