Microplastics, as emerging environmental pollutants, have garnered considerable attention due to their contamination of both the environment and food. Microplastics can infiltrate the human food chain through multiple pathways, potentially posing health risks to humans. Currently, non-destructive testing of microplastics in food is considered challenging. This study aims to investigate the feasibility of employing a portable Raman spectroscopy system for non-destructive detection of microplastic content (polystyrene, PS; polyethylene, PE) in flour. In this study, a portable spectrometer was used to collect flour spectra of different abundances of microplastics. To enhance the predictive performance of the partial least squares (PLS) model, a mixed variable selection strategy that combined the wavelength interval selection method (Synergy interval partial least squares, siPLS) and the wavelength point selection method (Least absolute shrinkage and selection operator, LASSO; Multiple feature-spaces ensemble by least absolute shrinkage and selection operator, MFE-LASSO) was proposed. Four regression models (PLS, siPLS, siPLS-LASSO, siPLS-MFE-LASSO) were developed and compared for detecting PS and PE content in flour. The siPLS-MFE-LASSO model exhibited the best generalization performance in the prediction set, and was considered to have the best generalization performance (PS: RP2 = 0.9889, RMSEP=0.0344 %; PE: RP2 = 0.9878, RMSEP=0.0361 %). In conclusion, this study has demonstrated the potential of using a portable Raman spectrometer in conjunction with a mixed variable selection algorithm for non-destructive detection of PS and PE content in flour, providing more possibilities for non-destructive detection of microplastic content in food.