Quitting undergraduate research internship I am an undergraduate in theoretical chemistry, and I am currently having a summer research internship at one of the top institutions in the world. I was dreaming about this experience for a long time, but now I think that I can't handle it. 

I started to feel drained of energy six months ago when my family had serious problems in their relationships, finances and health. Now, it's two weeks into my 8-week-long internship and I am unable to focus on anything at all. The only hope I have is that intermittently I have bursts of energy, when the idea of leaving seems preposterous, but they only last 1-2 days max. I also have troubles sleeping. 

I have always been a diligent student coming in top 1-5 in all examinations I sat. My internship last year also went quite well and my results from it resulted in a publication. I have never felt as I do now, and even though I'm trying really hard to pull myself together, I'm failing. 

I wonder how much quitting would affect my reputation, especially if I'm being honest that the issue is about my mental health. On the other hand, if I stay but am utterly unproductive, would it be worse?
I think it would be a mistake to discuss your mental health. But you can more safely discuss the issues that might have led to it. It is natural to feel drained when family/relationship issues take so much mental and emotional effort. 

The best thing, assuming you cannot continue, is to discuss the underlying issues with someone involved in the program. They might have some solutions for you that you don't see now, such as deferring your participation. Be sure to stress your interest in the program and your abilities, so that you have some positive things to say beyond any obstacles in your way. 

If I were the person you talked to, I would try to find a way to make it possible. Your background suggests you would be the sort of person the PI would want to accommodate. 

The comment of user scrappedcola also seems wise.