The impact of parasites on gut microbiota of the host is well documented, but the role of the relationship between the parasite and the host in the formation of the microbiota is poorly understood. Using 16S amplicon sequencing and newly developed methodological approaches, we characterize the gut microbiota of the sympatric pair of whitefish Coregonus lavaretus complex and the associated microbiota of cestodes parasitizing their intestine. The essence of the proposed approaches is, firstly, to use the method of successive washes of the microbiota from the cestode’s surfaces to analyze the degree of bacterial association to the tegument of the parasite. Secondly, to use a method combining the sampling of intestinal content and mucosa with the wash-out procedure from the mucosa to understand the real structure of the fish gut microbiota. Our results demonstrate that the trophic diversification of a sympatric pair of whitefish predetermines a segregation by ecological niches of their respective microbial communities within their intestine. Additional environmental niches for settlement of bacteria in the intestine are formed by the parasitic helminths that caused the restructuring of the bacterial community in infected fish compared to those uninfected. Using the desorption method in Ringer’s solution, we have demonstrated that Proteocephalus sp. cestodes possess their own microbial community which is put together from “surface” bacteria received from the host, bacteria which are weakly and strongly associated with the tegument, and microbiota obtained after removal of the tegument from the cestodes.