How do I tell thesis advisor I want to withdraw from research? (mental health)
First, I hope you are working with a mental health expert; I always hate to see people lose good opportunities due to issues like this. As Buffy says, you should definitely see if there is anyway you can make this work (though, a clean break is better than performing so poorly he has to fire you. A mental health expert can help you weigh these decisions).
At any rate, to your actual question:

how can I tell this Professor I want to withdraw?

Clearly and concisely. In person if possible, but if you cannot face that, an e-mail will do the trick:

Dear Professor,
Unfortunately, I am going to have to withdraw from research. I really enjoy working with you, the research has been very interesting, but due to some mental health issues, working in a group is not really feasible for me. It's nothing against [the other student], and I understand that research is often done in groups, but I'm not currently at a place where I can support group work. I am sorry to have to withdraw; thank you again for your efforts.
Name