This study investigates the impact of bedding materials and disinfectants on mastitis prevalence in dairy farming, focusing on key parameters such as herd size, housing conditions, bedding types, disinfectants, and bedding pH. Conducted as an observational study spanning 31 commercial dairy farms situated in diverse cities across Iran, our research encompassed a comprehensive dataset gathered from a total of 77,032 cows. The study was conducted over a continuous six-month period, during which we collected and analyzed data on a range of 740 to 5,280 cows across the participating farms. Bedding materials included manure, manure & soil, pumice, sand, and bagasse trash, with disinfectants like Calcium carbonate, Calcium hydroxide, Formalin, and lime applied. Teat and bedding samples were analyzed for mastitis prevalence, somatic cell count (SCC), bacterial load, and pH levels. Our findings reveal significant associations between farm factors and health indicators. Larger herd sizes were negatively associated with mastitis prevalence, while housing, bedding, and pH displayed significant negative associations. Disinfectants exhibited a positive association with mastitis prevalence. SCC levels were significantly negatively associated with bedding, indicating its influence on udder health. Bedding types and disinfectants demonstrated significant variations in mastitis prevalence, SCC, teat total count, and bed total count. Notably, manure bedding displayed the highest mastitis prevalence, while bagasse showed significant differences compared to other materials. In conclusion, this underscores the critical importance of bedding materials and disinfectants in ensuring the efficient management of dairy farms. Practical implications suggest considering alternative bedding materials, monitoring herd size, and selecting appropriate disinfectants to optimize udder health. This study contributes valuable insights into mastitis control, emphasizing the need for tailored interventions in dairy farm practices.