The air quality of the living area influences human health to a certain extent. Therefore, it is particularly important to detect the quality of indoor air. However, traditional detection methods mainly depend on chemical analysis, which has long been criticized for its high time cost. In this research, a rapid air detection method for the indoor environment using laser-induced breakdown spectroscopy (LIBS) and machine learning was proposed. Four common scenes were simulated, including burning carbon, burning incense, spraying perfume and hot shower which often led to indoor air quality changes. Two steps of spectral measurements and algorithm analysis were used in the experiment. Moreover, the proposed method was found to be effective in distinguishing different kinds of aerosols and presenting sensitivity to the air compositions. In this paper, the signal was isolated by the forest, so the singular values were filtered out. Meanwhile, the spectra of different scenarios were analyzed via the principal component analysis (PCA), and the air environment was classified by K-Nearest Neighbor (KNN) algorithm with an accuracy of 99.2%. Moreover, based on the establishment of a high-precision quantitative detection model, a back propagation (BP) neural network was introduced to improve the robustness and accuracy of indoor environment. The results show that by taking this method, the dynamic prediction of elements concentration can be realized, and its recognition accuracy is 96.5%.