The invention discloses a novel 17 beta-hydroxyl steroid dehydrogenase (17 beta-HSDcab) derived from candida albicans 7103 and a coding gene thereof; the enzyme is utilized as a biocatalyst to catalyse a substrate 17-carbonyl steroid compound to synthesize a 17 beta-hydroxyl steroid compound. The enzyme has a wide substrate spectrum, and especially has very high activity for androstane-4-alkene-3,17-diketone, androstane-4,9(11)-diene-3,17-diketone. A recombinant bacterium resting cell is taken as a biocatalyst, androstane-4-alkene-3,17-diketone is taken as a substrate, so that a target producttestosterone with a high yield is obtained with relatively high substrate feeding concentration, by-products are less, and the yield is not lower than 95%; and moreover, the conversion time is short,the used biocatalyst is less in dosage, and the space time yield is far higher than the current reported level.