The design of small molecules that inhibit disease-relevant proteins represents a longstanding challenge of medicinal chemistry. Here, we describe an approach for encoding this challenge-the inhibition of a human drug target-into a microbial host and using it to guide the discovery and biosynthesis of targeted, biologically active natural products. This approach identified two previously unknown terpenoid inhibitors of protein tyrosine phosphatase 1B (PTP1B), an elusive therapeutic target for the treatment of diabetes and cancer. Both inhibitors appear to target an allosteric site, which confers selectivity, and can inhibit PTP1B in living cells. A screen of 24 uncharacterized terpene synthases from a pool of 4464 genes uncovered additional hits, demonstrating a scalable discovery approach, and the incorporation of different PTPs into the microbial host yielded alternative PTP-specific detection systems. Findings illustrate the potential for using microbes to discover and build natural products that exhibit precisely defined biochemical activities yet possess unanticipated structures and/or binding sites.