The brain μ-opioid receptor (MOR) is critical for the analgesic, rewarding, and addictive effects of opioid drugs. However, in rat models of opioid-related behaviors, the circuit mechanisms of MOR-expressing cells are less known because of a lack of genetic tools to selectively manipulate them. We introduce a CRISPR-basedOprm1-Cre knock-in transgenic rat that provides cell-type specific genetic access to MOR-expressing cells. After performing anatomical and behavioral validation experiments, we used theOprm1-Cre knock-in rats to study the role of nucleus accumbens (NAc) MOR-expressing cells in heroin self-administration in male and female rats. Using RNAscope, autoradiography, and fluorescence in situ hybridization chain reaction (HCR-FISH), we found no differences inOprm1expression in NAc, dorsal striatum (DS), and dorsal hippocampus, or MOR receptor density (except DS) or function betweenOprm1-Cre knock-in rats and wildtype littermates. HCR-FISH assay showed that iCre is highly co-expressed with Oprm1 (95-98%). There were no genotype differences in pain responses, morphine analgesia and tolerance, heroin self-administration, and relapse-related behaviors. We used the Cre-dependent vector AAV1-EF1a-Flex-taCasp3-TEVP to lesion NAc MOR-expressing cells and report sex-specific effects: the lesions decreased acquisition of heroin self-administration in maleOprm1-Cre rats and had a stronger inhibitory effect on the effort to self-administer heroin in femaleOprm1-Cre rats. The validation of anOprm1-Cre knock-in rat enables new strategies for understanding the role of MOR-expressing cells in rat models of opioid addiction, pain-related behaviors, and other opioid-mediated functions. Our initial mechanistic study with these rats suggests a sex-specific role of NAc MOR-expressing cells in heroin self-administration.