Workplace discrimination may affect the health of the exposed employees, but it is not known whether workplace discrimination is also associated with an increased risk of long-term sickness absence. The aim of this study was to examine the longitudinal associations of changes in and onset of workplace discrimination with the risk of long-term sickness absence. Data on workplace discrimination were obtained from 29,597 employees participating in survey waves 2004, 2006, 2008 and/or 2010 of the Finnish Public Sector Study. Four-year changes in long-term sickness absence (≥10 days of medically certified absence with a mental or non-mental diagnosis) were assessed. This covered successive study waves in analyses of onset of workplace discrimination as well as fixed effect analyses of change in workplace discrimination (concurrent i.e. during the exposure year and 1-year lagged i.e. within one year following exposure), by using each employee as his/her own control. The risk of long-term sickness absence due to mental disorders was greater for employees with vs. without onset of workplace discrimination throughout the 4-year period, reaching a peak at the year when the onset of discrimination was reported (adjusted risk ratio 2.13; 95% confidence interval (CI) 1.80–2.52). The fixed effects analyses showed that workplace discrimination was associated with higher odds of concurrent, but not 1-year lagged, long-term sickness absence due to mental disorders (adjusted odds ratio 1.61; 95% CI 1.33–1.96 and adjusted odds ratio 1.02; 95% CI 0.83–1.25, respectively). Long-term sickness absence due to non-mental conditions was not associated with workplace discrimination. In conclusion, these findings suggest that workplace discrimination is associated with an elevated risk of long-term sickness absence due to mental disorders. Supporting an acute effect, the excess risk was confined to the year when workplace discrimination occurred.