During social interactions, people decide whether to trust an actor based on their punitive behaviour. Several empirical studies have indicated that punishment intensity impacts observer trust, yet the underlying mechanism remains to be elucidated. This study included 242 junior high school students and was conducted to investigate the relationship between teachers’ punishment intensity and levels of student bystander trust. Additionally, the mediating role of trustworthiness and the moderating role of group relationships were explored. The results showed that the relationship between punishment intensity and observer trust follows an inverted U-shaped pattern. In addition, mild punishment boosts observer trust by improving perceived trustworthiness (ability and integrity) compared to no punishment, while harsh punishment reduces observer trust more than mild punishment by diminishing perceived trustworthiness (ability, benevolence, and integrity). More importantly, group relationships positively moderate the relationship between punishment intensity and observer trust. Specifically, compared to mild or no punishment, harsh punishment decreases trustworthiness (ability, benevolence, and integrity) in close teacher–student relationships but has less impact on neutral relationships. The above findings demonstrate that guiding educators in developing appropriate disciplinary concepts contributes to enhancing student observer trust.