Provided in the present invention are a steroidal compound, a composition containing the same and a use thereof. Specifically, disclosed in the present invention are a steroidal compound as shown in formula (I) and a drug composition containing the same, or a crystal form, a pharmaceutically acceptable salt, a hydrate or solvate, a stereoisomer, a prodrug, a metabolite or an isotopic variant thereof. The compound according to the present invention can be used as a CYP17 enzyme inhibitor, and has better pharmacokinetic parameters, which can improve drug concentration of the compound in an animal, thereby improving the efficacy and safety of the drug, and in turn the compound may be applied in the preparation of the drug for treating CYP17 enzyme-related diseases (such as prostate cancer).