Midbrain ventral tegmental neurons project to the prefrontal cortex and modulate cognitive functions. Using viral tracing, optogenetics and electrophysiology, we found that mesocortical neurons in the mouse ventrotegmental area provide fast glutamatergic excitation of GABAergic interneurons in the prefrontal cortex and inhibit prefrontal cortical pyramidal neurons in a robust and reliable manner. These mesocortical neurons were derived from a subset of dopaminergic progenitors, which were dependent on prolonged Sonic Hedgehog signaling for their induction. Loss of these progenitors resulted in the loss of the mesocortical inhibitory circuit and an increase in perseverative behavior, whereas mesolimbic and mesostriatal dopaminergic projections, as well as impulsivity and attentional function, were largely spared. Thus, we identified a previously uncharacterized mesocortical circuit contributing to perseverative behaviors and found that the diversity of dopaminergic neurons begins to be established during their progenitor phase.