  In this paper, we prove a Lefschetz trace formula for B\"ockle-Pink crystals
on tame Deligne-Mumford stacks of finite type over $\mathbb{F}_q$ and apply it
to the crystal associated to the universal Drinfeld module. Combined with the
Eichler-Shimura theory developed by B\"ockle, this leads to a trace formula for
Hecke operators on Drinfeld modular forms. As a corollary, we deduce a
Ramanujan bound on the traces of Hecke operators.
