Drug-induced interstitial pneumonitis (DIP) is an inflammation of the lung interstitium, emerging due to the pneumotoxic effects of pharmaceuticals. The diagnosis is challenging due to nonspecific clinical presentations and limited testing. Therefore, identifying the risk of drug-related pneumonitis is required during the early phases of drug development. This study aims to estimate DIP using binary quantitative structure-toxicity relationship (QSTR) models. The dataset was composed of 468 active pharmaceutical ingredients (APIs). Five critical modeling descriptors were chosen. Then, four machine-learning (ML) algorithms were conducted to build prediction models with the selected molecular identifiers. The developed models were validated using the internal 10-fold cross-validation and external test set. The Logistic Regression (LR) algorithm outperformed all other models, achieving 95.72% and 94.68% accuracy in internal and external validation, respectively. Additionally, the individual effect of each descriptor on the model output was determined using the SHapley Additive exPlanations (SHAP) approach. This analysis indicated that the pneumonitis effects of drugs might predominantly be attributed to their atomic masses, polarizabilities, van der Waals volumes, surface areas, and electronegativities. Apart from the strong model performance, the SHAP local explanations can assist molecular modifications to reduce or avoid the risk of pneumonitis for each molecule in the test set. Contributing to the drug safety profile, the current classification model can guide advanced pneumotoxicity testing and reduce late-stage failures in drug development.