Stabilized sewage sludge is applied to agricultural fields and farmland due to its high organic matter content. The aim of this study was to investigate the effects of two types of sludge stabilization, mesophilic anaerobic digestion (MAD) and thermophilic anaerobic digestion (TAD), on bacterial communities in sludge, including the presence of pathogenic microorganisms. Bacterial community structure and phylogenetic diversity were analyzed in four sewage sludge samples from the Czech Republic. Analysis of 16S ribosomal RNA (rRNA) genes showed that investigated sludge samples harbor diverse bacterial populations with only a few taxa present across all samples. Bacterial diversity was higher in sludge samples after MAD versus TAD treatment, and communities in MAD-treated sludge shared the highest genetic similarities. In all samples, the bacterial community was dominated by reads affiliated with Proteobacteria. The sludge after TAD treatment had considerably higher number of reads of thermotolerant/thermophilic taxa, such as the phyla Deinococcus-Thermus and Thermotogae or the genus Coprothermobacter. Only one operational taxonomic unit (OTU), which clustered with Rhodanobacter, was detected in all communities at a relative abundance >1 %. All of the communities were screened for the presence of 16S rRNA gene sequences of pathogenic bacteria using a database of 122 pathogenic species and ≥98 % identity threshold. The abundance of such sequences ranged between 0.23 and 1.57 % of the total community, with lower numbers present after the TAD treatment, indicating its higher hygienization efficiency. Sequences clustering with nontuberculous mycobacteria were present in all samples. Other detected sequences of pathogenic bacteria included Streptomyces somaliensis, Acinetobacter calcoaceticus, Alcaligenes faecalis, Gordonia spp., Legionella anisa, Bordetella bronchiseptica, Enterobacter aerogenes, Brucella melitensis, and Staphylococcus aureus.