The reaction of enaminonitrile 2 with hydrazine hydrate yielded 5‐amino pyrazole derivative 4. Compound 4 reacted with ethyl acetoacetate, enaminone 8, chalcone 12, enaminonitrile 2, arylidene malononitrile 18, 3‐(3,5‐dimethyl‐1H‐pyrazol‐1‐yl)‐3‐oxopropanenitrile 21 and phenacyl bromide to give the corresponding pyrazolopyrimidine derivatives 7, 11, 14, 17, 20, 23, and imidazopyrazole 25, respectively. The newly synthesized compounds were characterized by spectral and elemental analyses. The antimicrobial activities of the new compounds were tested against S. aureus, E. coli, and C. albicans. It was found that compound 23 exhibited the highest antimicrobial activity against the tested microorganisms. All tested compounds did not have antifungal activity against A. niger as a fungal strain. Utilizing drug‐likeness (ADME) and molecular docking the effectiveness of compound 23 towards G+ve and G‐ve bacteria has been studied. Accordingly, compound 23 is expected to have a high chance of oral bioavailability due to its compliance with Lipinski′s rule of five. In addition, it plays a critical role in the inhibition of bacterial S. Ribosome, dihydropteroate synthase, transpeptidase, and gyrase B. subunit proteins.