We extend the theory of Ihara zeta functions to noncompact arithmetic quotients of Bruhat–Tits trees. This new zeta function turns out to be a rational function despite the infinite-dimensional setting. In general, it has zeros and poles in contrast to the compact case. The determinant formulas of Bass and Ihara hold if we define the determinant as the limit of all finite principal minors. From this analysis we derive a prime geodesic theorem, which, applied to special arithmetic groups, yields new asymptotic assertions on class numbers of orders in global fields.