Terahertz time-domain spectroscopy combined with chemometrics is utilized to identify imidacloprid and carbendazim in a flour substrate.