The electrochemical oxidation of 1,4-dihydropyridines and 2,3-dihydroquinazolinones by 4-phenyl urazole (4-PU) as an effective mediator to produce selective products with excellent yields in a phosphate buffer (pH = 3) solution under mild reaction conditions is presented. The electrochemical reactions were performed in a mixture of acetonitrile: water 80:20 as solvent under a constant potential of 0.6 V vs SCE. The electrocatalytic properties of the mediator were investigated by the cyclic voltammetry technique. At the applied potential, the generation/regeneration of 1,2,4-triazole-3,5-diones/4-phenyl triazoledione occurred, and the oxidation of 1,4-dihydropyridines and 2,3-dihydroquinazolinones derivatives at reduced overpotential led to the formation of products with high efficiency. The presented electrogenerated mediator is promising for the selective electrocatalytic oxidative dehydrogenation of N-heterocycle compounds under mild conditions.