Genotyping of thiopurine S-methyltransferase (TPMT) is recommended for predicting the adverse drug response of thiopurines. In the current study, a novel version of allele-specific PCR (AS-PCR), termed competitive real-time fluorescent AS-PCR (CRAS-PCR) was developed to analyze the TPMT*2 genotype in ethnic Chinese. This technique simultaneously uses wild-type and mutant allele-specific scorpion primers in a single reaction. To determine the optimal conditions for both traditional AS-PCR and CRAS-PCR, we used the Taguchi method, an engineering optimization process that balances the concentrations of all components using an orthogonal array rather than a factorial array. Instead of running up to 264 experiments with the conventional factorial method, the Taguchi method achieved the same optimization using only 16 experiments. The optimized CRAS-PCR system completely avoided non-specific amplification occurring in traditional AS-PCR and could be performed at much more relaxed reaction conditions at 1% sensitivity, similar to traditional AS-PCR. TPMT*2 genotyping of 240 clinical samples was consistent with published data. In conclusion, CRAS-PCR is a novel and robust genotyping method, and the Taguchi method is an effective tool for the optimization of molecular analysis techniques.