Xenobiotics can easily harm human lungs owing to the openness of the respiratory system. Identifying pulmonary toxicity remains challenging owing to several reasons: 1) no biomarkers for pulmonary toxicity are available that might help to detect lung injury; 2) traditional animal experiments are time-consuming; 3) traditional detection methods solely focus on poisoning accidents; 4) analytical chemistry methods hardly achieve universal detection. An in vitro testing system able to identify the pulmonary toxicity of contaminants from food, the environment, and drugs is urgently needed. Compounds are virtually infinite, whereas toxicological mechanisms are countable. Therefore, universal methods to identify and predict the risks of contaminants can be designed based on these well-known toxicity mechanisms. In this study, we established a dataset based on transcriptome sequencing of A549 cells upon treatment with different compounds. The representativeness of our dataset was analyzed using bioinformatics methods. Artificial intelligence methods, namely partial least squares discriminant analysis (PLS-DA) models, were employed for toxicity prediction and toxicant identification. The developed model predicted the pulmonary toxicity of compounds with a 92 % accuracy. These models were submitted to an external validation using highly heterogeneous compounds, which supported the accuracy and robustness of our developed methodology. This assay exhibits universal potential applications for water quality monitoring, crop pollution detection, food and drug safety evaluation, as well as chemical warfare agent detection.