Let \(S_k(N)\) denote the space of cusp forms of even integer weight k and level N. We prove an asymptotic for the Petersson trace formula for \(S_k(N)\) under an appropriate condition. Using the non-vanishing of a Kloosterman sum involved in the asymptotic, we give a lower bound for discrepancy in the Sato–Tate distribution for levels not divisible by 8. This generalizes a result of Jung and Sardari (Math Ann 378(1–2):513–557, 2020, Theorem 1.6) for squarefree levels. An analogue of the Sato-Tate distribution was obtained by Omar and Mazhouda (Ramanujan J 20(1):81–89, 2009, Theorem 3) for the distribution of eigenvalues \(\lambda _{p^2}(f)\) where f is a Hecke eigenform and p is a prime number. As an application of the above-mentioned asymptotic, we obtain a sequence of weights \(k_n\) such that discrepancy in the analogue distribution obtained in Omar and Mazhouda (Ramanujan J 20(1):81–89, 2009) has a lower bound.