Research evidence suggests that athletes’ attitudes towards banned substances are among the strongest predictors of intention to use or actual practice of doping. Previous research has found that personal morality was negatively related to doping attitudes. However, less is known about the role of athletes’ perceptions of fair play on their attitudes towards doping. First, we examined whether moral identity was associated with athletes’ attitudes towards doping and whether their perceptions of fair play mediated this relationship. The second purpose was to determine whether these associations differed among non-athletes. Overall, 365 university students (49.9% males, 55.3% athletes) participated in this study (mean age 22.02, SD = 6.58). They completed questionnaires measuring the aforementioned variables. The results showed that athletes’ moral identity and endorsement of fair play were negatively associated with their attitudes towards doping. The mediation analyses showed that the effect of moral identity on attitudes towards doping was partially mediated by perceptions of fair play (indirect effect, β = −0.10, p < 0.05). Unlike student athletes, non-athletes’ moral identity negatively predicted attitudes towards doping only indirectly, via fair play perception (indirect effect, β = −0.08, p < 0.05). The study provides insights into how a person’s morality and perception of moral values in sport may act as factors related to doping in sport. The practical implications for the promotion of anti-doping attitudes for athletes and separately for student non-athletes were provided together with future research perspectives.