The major histocompatibility complex (MHC) determines the immune response, and the MHC genes are promising candidate genes for identifying associations with diseases. The decisive role in the resistance of cattle to diseases belongs to the major histocompatibility complex of (BoLA). The BoLA system consists of several jointly operating genes that provide antigen presentation by MHC system molecules followed by an immune response to pathogenic microorganisms. The most functional is the BoLA-DRB3 gene. Its exon 2 is highly polymorphic and encodes the peptide antigen-binding cleft. Alleles, for which a close connection with disease susceptibility or disease resistance has been detected, are considered as DNA markers. These play a decisive role in the breeding of cattle to create herds resistant to diseases, including mastitis. This paper presents the results of a study of BoLA-DRB3 gene polymorphism in two commercial cattle breeds: the Ukrainian black-pied dairy (UBPD) and the Ukrainian red-pied dairy (URPD) and its association with mastitis. The UBPD and the URPD cows were genotyped at the bovine lymphocyte antigen DRB3.2 locus by a genotyping system that used polymerase chain reaction and restriction fragment length polymorphisms (PCR-RLFP). In 276 UBPD cows, 32 BoLA-DRB alleles have been found. Six alleles (*03, *08, *10, *22, *24 and *28) were identified with a frequency of more than 5% (total amount of 50.4%). The allele BoLA-DRB3.2*24 was the most frequent (19.2%). In the UBPD population (n = 162), four BoLA-DRB3.2 alleles are truly associated with mastitis: *24 and *26 with susceptibility and *13 and *22 with resistance. In 117 URPD cows, 22 alleles were identified, of which the most frequent were *07, *22, *11, *24, *01, *03 and *16 (total frequency 64.5%). Allele BoLA-DRB3.2*07 (present in 25.6% of cows) was the most commonly found. In the URPD population studied, four alleles truly associated with mastitis were identified. Animals susceptible to the disease had alleles *07 and *08, and resistant animals had alleles *22 and *24. Breeding activities for the creation of cattle resistant to mastitis using alleles of the BoLA-DRB3 gene are much more effective than treatment and special care for animals. Similar research should be carried out for other Ukrainian breeds in relation to various diseases (leukemia, necrobacteriosis, etc.).