Reputation provides important information to society by recording the historical behavior of individuals. The introduction of reputation helps explain the cooperation phenomenon in human society to some extent. However, in previous explanation models, the benefits of a good reputation bring to individuals are generally described from the perspective of future payoffs they can obtain. In reality, the reputation system also affects the process of mutual imitation among individuals. For instance, the willingness of an individual with a high reputation learning from an individual with a low reputation can be greatly discounted. As such, this paper considers the reputation-based discount effect in imitation and extends the research on reputation from the perspective of imitation learning. Specifically, two situations of discount effect are considered. One is based on relative reputation difference, that is, if the reputation of an individual being imitated is too low compared to the strategy updater and the difference between which exceeds a threshold, the probability of imitation will be discounted. The other is based on absolute reputation difference, that is, if the absolute reputation of an individual being imitated falls below a threshold, the probability of imitation will be discounted. The effect of different thresholds and discount parameters on the evolution of cooperation in spatial public goods games is investigated, respectively, in both situations. Simulation results show that the reputation-based discount effect in mutual imitation plays an important role in the emergence and maintenance of cooperative behavior. Especially, low threshold differences for reputation and high discounts can greatly expand the range of parameters in which cooperation emerges. Moreover, compared with the relative reputation situation, the discount effect based on the absolute reputation is more conducive to the evolution of cooperation.