Yes having a mental illness can get you excused from jury duty.
If your mental illness is severe enough to where it makes it impossible for you to serve on the Jury then you can and will usually be excused without much trouble.
If you have a slight mental illness then you might still have to serve on the Jury duty.
You can always try to prove hardship or if you do have the mental illness then you can prove to the judge through your doctor that you have a severe enough mental health issue that prevents you from serving on the Jury.
Or you can simply not respond to the Jury duty summons which I have done for 15 years now.
Never have I gotten into trouble for not responding to a Jury duty letter.
So you can simply destroy the Jury duty letter and not show up.