Vermicomposting is a process by which earthworms together with microorganisms degrade organic wastes into a humus-like material called vermicompost. This process does not include a thermophilic stage, and therefore, the possible presence of pathogens represents a potential health hazard. To elucidate the effect of earthworms in the selective reduction of pathogens, grape marc substrate was artificially inoculated with Escherichia coli, Enterococcus spp., thermotolerant coliform bacteria (TCB), and Salmonella spp., and their reduction during vermicomposting was monitored. Various defense mechanisms eliminating microorganisms in the earthworm gut were assumed to be involved in the process of pathogen reduction. Therefore, we followed the expression of three pattern recognition receptors (coelomic cytolytic factor (CCF), lipopolysaccharide-binding protein (LBP), and Toll-like receptor (v-TLR)), two antimicrobial molecules (fetidin/lysenins and lysozyme), and heat shock protein HSP70. We detected the significant decrease of some defense molecules (fetidin/lysenins and LBP) in all pathogen-inoculated substrates, and the increase of CCF and LBP in the Salmonella spp.-inoculated substrate. At the same time, the reduction of pathogens during vermicomposting was assessed. We observed the accelerated reduction of E. coli, Enterococcus spp., and TCB in pathogen-inoculated substrates with earthworms compared to that without earthworms. Moreover, the differences between the microbiome of grape marc substrate and earthworm intestines were determined by high throughput sequencing. This analysis revealed that the bacterial composition of grape marc substrate differed from the composition of the content of earthworm intestines, suggesting the elimination of specific bacterial species during food passage through the gut.