Background: Algeria’s dairy sector is experiencing various obstacles, such as a high frequency of diseases in dairy farms, particularly mastitis. Nonetheless, there has been a scarcity of research on mastitis occurrence, notably in Algeria’s Western area. As a result, the purpose of this study was to investigate the prevalence of mastitis and its associated risk factors in Algeria’s northwest area. Methods: The study included 130 dairy cows from 17 farms. The California mastitis test (CMT) and visual inspection were used to determine the prevalence of subclinical and clinical mastitis. Result: The total cow-level prevalence was 68.50% (89/130), with clinical cases accounting for 3.10% (4/130) and subclinical cases accounting for 65.40% (85/130). The quarter-level prevalence of mastitis was 35.19% (183/520), with 3.08% (16/520) clinical cases and 32.11% (167/520) subclinical cases. The study found that parity, lactation stage and age were all significant intrinsic risk factors for mastitis (P less than 0.05). Additionally, cow cleanliness level, cleaning solution, wiping udder after washing and dry cow treatment were significant extrinsic risk factors linked with mastitis (P less than 0.05). Given the high prevalence of mastitis in this region, regular screening and treatment are crucial to minimize the risk of mastitis and enhance cow health.