This article presents an efficient one-step synthesis of tetrahydropyrazolo[1,5-a]pyrimidines through the recyclization of N-arylitaconimides with aminopyrazoles. The heterocyclic system of pyrazolo[3,4-b]pyrimidine is known for its diverse biological properties, making its derivatives significant in pharmaceutical and medicinal chemistry. The study focuses on the regio- and chemoselective cascade reaction of N-arylitaconimides with 5-aminopyrazoles, demonstrating a new approach to synthesizing pyrazolo[1,5-a]pyrimidines and pyrazolo[3,4-b]pyridines. The methodology, involving boiling in isopropyl alcohol with acetic acid, yields selectively either pyrazolo[3,4-b]pyridines or pyrazolo[1,5-a]pyrimidines based on the substituents in the aminopyrazoles. The study elucidates the reaction mechanism, structural characterization using NMR spectroscopy, and confirms the structures via high-performance liquid chromatography and mass spectrometry. The simplicity and synthetic potential of this approach make it a valuable method for the preparation of these heterocyclic frameworks.