Derivatives of 3β-hydroxyandrost-5,16-diene and 3β-hydroxyandrost-5-ene containing 2-oxazoline, 2-benzoxazole, and 2-benzimidazole substituents at C-17 position were synthesized. Docking of the synthesized compounds into the active site of human CYP17A1 predicted their high affinity for the enzyme. Of the 6 new compounds, 5 suppressed the proliferation of prostate carcinoma cells LNCaP and PC-3, and the activity of the oxazoline and benzimidazole derivatives of androsta-5,16-diene significantly exceeded the activity of the known anticancer agents abiraterone and galeterone.