There is a great threat to the production safety of coal mines caused by mine water disasters. Traditional identification methods are not adapted to the efficiency of today’s coal mining and do not offer the advantage of accurate detection in real-time. In this study, the Mayfly Algorithm (MA) was used to optimize the Long Short-Term Memory (LSTM) network, combined with laser-induced fluorescence technology, to apply it to the identification of mine water sources for the prevention of mine water disasters and post-disaster relief work. Taking sandstone water and goaf water as the original samples, five mixed water samples were also prepared by mixing the sandstone water and goaf water in different proportions, giving a total of seven water samples to be tested. Laser-induced fluorescence technology was used to obtain the fluorescence spectral data of water samples, and then the Linear Discriminant Analysis (LDA) dimensionality reduction algorithm and the Principal Component Analysis (PCA) dimensionality reduction algorithm were used to reduce the dimensions of the original spectral data. Then, three architectures, including LSTM, GA-LSTM (optimization of the LSTM by genetic algorithm) and MA-LSTM were designed to identify mine water sources. Finally, from the results’ analysis, MA-LSTM performs best in many aspects after PCA dimensionality reduction and has the best identification effect. These results supported the feasibility of the novel method.