Timely and accurate identification of harmful bacterial species in the environment is paramount for preventing the spread of diseases and ensuring food safety. In this study, laser-induced breakdown spectroscopy technology was utilized, combined with four machine learning methods - KNN, PCA-KNN, RF, and SVM, to conduct classification and identification research on 7 different types of bacteria, adhering to various substrate materials. The experimental results showed that despite the nearly identical elemental composition of these bacteria, differences in the intensity of elemental spectral lines provide crucial information for identification of bacteria. Under conditions of high-purity aluminum substrate, the identification rates of the four modeling methods reached 74.91%, 84.05%, 85.36%, and 96.07%, respectively. In contrast, under graphite substrate conditions, the corresponding identification rates reached 96.87%, 98.11%, 98.93%, and 100%. Graphite is found to be more suitable as a substrate material for bacterial classification, attributed to the fact that more characteristic spectral lines are excited in bacteria under graphite substrate conditions. Additionally, the emission spectral lines of graphite itself are relatively scarce, resulting in less interference with other elemental spectral lines of bacteria. Meanwhile, SVM exhibited the highest precision rate and recall rate, reaching up to 1, making it the most effective classification method in this experiment. This study provides a valuable approach for the rapid and accurate identification of bacterial species based on LIBS, as well as substrate selection, enhancing efficient microbial identification capabilities in fields related to social security and military applications.