A longitudinal study was carried out in Middle atlas, Morocco (locality of Had Oued Ifrane) in a population of 255 dogs from three localities, including two categories of dogs (owned and stray dogs). The dogs were investigated three times over a period ranging from 4 to 8 months between December and August. At each investigation, dogs were treated with arecoline, inducing defecation and allowing feces collection. Dogs were further treated with praziquantel to clear them from Echinococcus granulosus. Microscopic examination of feces was performed to assess the infection status of dogs at each investigation, and positive samples underwent copro-PCR to determine the circulating strain of E. granulosus. A high prevalence of infestation ranging from 23.5% to 38.8% and from 51.3% to 68.5% was, respectively, found in owned and in stray dogs. The PCR results revealed the presence of G1 strain in all positive samples. A logistic regression model was used to determine the incidence of infestation and showed that stray dogs underwent a significantly higher risk of infection (odds ratio = 14; 95% confidence interval: 6-30; p < 0.001) compared with owned dogs. Only anthelmintic treatment intervals of 2 months efficiently prevented egg shedding in owned and stray dogs. The seasonal effect was also significant, with the highest risk of reinfestation in winter and the lowest risk in summer. This study confirms that stray dogs undergo an increased risk of infestation by E. granulosus and indicate that infective pressure is influenced by season.