You do not have the time to worry about homeowners issues, and you want to be mobile at graduation. It’s good to have the freedom. Also, advisors move, and grants expire. Having $200k in cash instead of none and a mortgage is a big advantage while you’re preparing for candidacy.
Financially, the best thing is either to get UCSD subsidized housing (if you get married you can get a bonus and skip up in line). Or rent a 3-4 bd house with other grad students/postdocs.
Also if you go to the UCSD housing office you may find good deals, e.g. long-time professors who have a nice place, maybe a guest house in the back that they want to rent. grad students are generally viewed as more responsible than the undergrads, and are preferred. These deals will probably be below market rate.
I don’t think you’ll be able to charge $800 a month for a room on a $350k place.
$200k at 4% interest is $8k a year, right? Consider that too when you consider your housing costs.
in my opinion, i’d never buy in this circumstance.