Aflatoxin is the main carcinogen that contaminates agricultural products and foods such as peanuts and corn. There are many kinds of aflatoxins, mainly including aflatoxin B1 (AFB1), aflatoxin B2 (AFB2), aflatoxin G1 (AFG1) and aflatoxin G2 (AFG2). Different types of aflatoxins have different toxicity and different levels of contamination to agricultural products as well as food. Therefore, the rapid, non-destructive and highly sensitive qualitative identification of aflatoxin species is of great significance to maintain people's life and health. The conventional terahertz detection method can only qualitatively identify the samples at the milligram level, but it is not suitable for the qualitative analysis of trace samples. In this paper, a terahertz metamaterial sensor with "X" composite double-peak structure was designed based on electromagnetic theory to investigate the feasibility of THz-TDS technology based on a metamaterial sensor for the qualitative identification of trace aflatoxin B2, G1 and G2 solutions. Firstly, the terahertz transmission spectra of eight different concentrations of aflatoxin B2, G1 and G2 were collected respectively, and then the differences of terahertz transmission spectra of different aflatoxin species were investigated. Finally, the terahertz transmission spectra of aflatoxin B2, G1 and G2 solutions were modeled and analyzed using chemometric methods. It was found that there were significant differences in the transmission peak curves of different kinds of aflatoxin. Through the comparative analysis of different models, it was concluded that the prediction accuracy of the CARS-RBF-SVM model was the highest, and the accuracy of the calibration set reached 100%. 119 out of 120 predicted samples were correctly predicted, and the prediction accuracy was 99.17%. This study verified the feasibility of qualitative identification of trace aflatoxin B2, G1 and G2 solutions by a metamaterial sensor based on the "X" composite double-peak structure combined with THz-TDS technology, and provided a theoretical basis and a new detection method for the qualitative identification of trace aflatoxins. This will facilitate the rapid, non-destructive and highly sensitive qualitative detection of different kinds of aflatoxins in food and agricultural products. At the same time, this study has important implications for promoting the qualitative detection of other trace substances.