Accurate identification of plastic materials from post-consumer food container and packaging waste is crucial for enhancing the purity and added value of recycled materials, thereby promoting recycling and addressing the issue of plastic pollution. However, the diverse characteristics of post-consumer plastics—such as variations in shape and additives—cause variations in spectral features like transmittance, even within the same material type. In this study, we combined near-infrared (NIR) and terahertz (THz) spectroscopies with machine learning (ML) techniques, specifically XGBoost and Bayesian optimization, to accurately identify transparent polyethylene terephthalate (PET), transparent polystyrene (PS), and black PS. We achieved a precision score exceeding 90%. Furthermore, using explainable AI (XAI) techniques, we evaluated the roles of NIR and THz waves in distinguishing between these plastics. We found that transmittance measured at a frequency of 0.140 THz was effective for identifying transparent PS, while the transmittance at 0.075 THz was crucial for identifying transparent PET. Additionally, NIR spectroscopy proved to be highly effective in distinguishing black PS from transparent plastics. Our findings indicate that the significance of THz frequencies varies depending on the material, highlighting that the identification technology developed in this study not only complements widely used NIR spectroscopy but also offers valuable insights into selecting effective frequencies for high-precision identification systems. Additionally, we discuss potential directions for further research to advance identification systems utilizing THz spectroscopy and ML techniques based on these findings.