Discovery of a potent SARS-CoV-2 main protease (M(pro)) inhibitor is the need of the hour to combat COVID-19. A total of 1000 protease-inhibitor-like compounds available in the ZINC database were screened by molecular docking with SARS-CoV-2 M(pro) and the top 2 lead compounds based on binding affinity were found to be 1,2,4 triazolo[1,5-a] pyrimidin-7-one compounds. We report these two compounds (ZINC000621278586 and ZINC000621285995) as potent SARS-CoV-2 M(pro) inhibitors with high affinity (<-9 kCal/mol) and less toxicity than Lopinavir and Nelfinavir positive controls. Both the lead compounds effectively interacted with the crucial active site amino acid residues His41, Cys145 and Glu166. The lead compounds satisfied all of the druglikeness rules and devoid of toxicity or mutagenicity. Molecular dynamics simulations showed that both lead 1 and lead 2 formed stable complexes with SARS-CoV-2 M(pro) as evidenced by the highly stable root mean square deviation (<0.23 nm), root mean square fluctuations (0.12 nm) and radius of gyration (2.2 nm) values. Molecular mechanics Poisson-Boltzmann surface area calculation revealed thermodynamically stable binding energies of -129.266 +/- 2.428 kJ/mol and - 116.478 +/- 3.502 kJ/mol for lead1 and lead2 with SARS-CoV-2 M(pro), respectively.