How can I quit an internship before the agreed upon end date without burning bridges? I'm a recent college graduate, and I'm currently four months into a research internship. My original plan was to take a year off before applying to graduate school (in physics) and use this internship as an interim job. The full story is complicated, and I don't want to go into especially much detail, but I've been dealing with mental health issues for several years now, and I've realized that I really need to take some more time and get professional help and actually put effort into dealing with this rather than going to grad school next year. I don't think that staying at this internship, in a city/state where I don't know anyone, and which it turns out isn't that related to my interests, is the most productive way to do that. So, what I would like to do is to quit at the end of this year, when my funding is up for review. I'm not really doing important work for the team, so I don't think my leaving early would actually be a significant hardship for anyone, and furthermore I am saving them the trouble of trying to find new funding to keep me here. But, I don't want to sound ungrateful to them for taking me on as an intern to begin with, or for the effort my mentor has put into helping me out with my projects so far, and I'd really like it if I could still get a rec letter from him when I do apply for grad school (my mentor has told me on several occasions that he is pleased with my work so far, so I'm pretty sure he would write me a good one).

So: how should I frame my conversation with my supervisor about leaving before the initially agreed upon end date? Should I talk about my interests not lining up with the group's work? Should I talk about my doubts about wanting to go to grad school immediately? This is not the sort of thing I've ever done before (quitting) and I wouldn't do it if I didn't feel like I had very compelling reasons to do so, but I don't necessarily think that it would be professional to share my actual reasons given general stigma against mental health problems, hence my need for advice.
You haven't said where you are, but from your reference to living in an unfamiliar state, I'm going to assume you're in the US.

I honestly think your best course of action is to say you need to quit for medical reasons requiring treatment. You can stop there, any US employer should know better than to pry at that point.

This has the upsides of a) being entirely true; and b) doesn't leave your employer wondering if they did something wrong.