Microbial communities react rapidly and specifically to changing environments, indicating distinct microbial fingerprints for a given environmental state. Machine learning with community data predicted the Baltic Sea-detected pollutants glyphosate and 2,4,6-trinitrotoluene, using the developed R package “phyloseq2ML”. Predictions by Random Forest and Artificial Neural Network were accurate. Relevant taxa were identified. The interpretability of machine learning models was found of particular importance. Microbial communities predicted even minor influencing factors in complex environments.