Background Recent works suggested taking into account the severity and the type of anhedonia when examining suicidal ideation. The present study investigated a moderated mediation model addressing the psychosocial mechanisms that account for the association between state or trait anhedonia and suicidal ideation. Methods State anhedonia was assessed using the Snaith-Hamilton Pleasure Scale, while trait anhedonia was assessed using the Temporal Experience of Pleasure Scale. A total number of 1,361 of undergraduates completed questionnaires at three different times, with one-year intervals. Results The direct effect of stress on suicidal ideation was significantly greater for those students who had lower trait anticipatory and consummatory anhedonia, whereas the indirect effect from stress on suicidal ideation through depression was significantly greater for those who had higher state anhedonia. Moreover, trait consummatory anhedonia moderated the relationship between stress and suicidal ideation after one year, and trait anticipatory anhedonia moderated the relationship between stress and suicidal ideation after two years. Conclusions Low levels of trait anhedonia were associated with elevated suicidal ideation, while high levels of state anhedonia were associated with elevated suicidal ideation. Trait consummatory anhedonia was associated with short-term suicidal ideation, while trait anticipatory anhedonia was associated with long-term suicidal ideation.