Abstract Opioid use disorder (OUD) has become a leading cause of death in the US, yet current therapeutic strategies remain highly inadequate. To identify novel potential treatments for OUD, we screened a targeted selection of over 100 drugs, using a recently developed opioid self-administration assay in zebrafish. This paradigm showed that finasteride, a steroidogenesis inhibitor approved for the treatment of benign prostatic hyperplasia and androgenetic alopecia, reduced self-administration of multiple opioids without affecting locomotion or feeding behavior. These findings were confirmed in rats; furthermore, finasteride did not interfere with the antinociceptive effect of opioids in rat models of neuropathic pain. Steroidomic analyses of the brains of fish treated with finasteride revealed a significant increase in dehydroepiandrosterone sulfate (DHEAS). Treatment with precursors of DHEAS reduced opioid self-administration in zebrafish, in a fashion akin to the effects of finasteride. Our results highlight the importance of steroidogenic pathways as a rich source of therapeutic targets for OUD and point to the potential of finasteride as a new option for this disorder.