The invention belongs to the field of pharmacogenomics and genetic diagnosis, and relates to a method used for detecting HLA-B*5801 alleles. The method comprises following steps: a DNA sample to be detected is taken, three pairs of specific primers and a pair of internal primers are taken, amplification of DNA segments is realized by using sequence specific primer method, and then the results of the amplification are analyzed by agarose gel electrophoresis; or sample DNA is extracted, a pair of specific primers, a pair of internal primers and three fluorescence probes are taken, amplification of DNA segments is realized by Taqman probe method using a fluorescence ration PCR instrument, and then the amplification curve is analyzed so as to obtain results. Results analysis methods such as agarose gel electrophoresis, high resolution melting curve and SYBRGreen fluorogenic quantitative PCR are employed in the method. The method has advantages of speediness, convenience, flexibility, high resolution and no contamination; is suitable for detection of HLA-B*5801 alleles in samples such as peripheral blood and hair; and can be used for determining the probability of severe skin adverse reaction of patients with gout or hyperuricemia caused by taking of allopurinol.