It would be serious ethical misconduct for your advisor to try to publish your work under his own name. If you find that it has been done, a note to the journal editor or conference chair would have serious repercussions for his career. You could also, then, file a claim with the university, perhaps resulting in his getting reprimanded or fired. It is serious enough that few would be willing to risk the harm it would cause themselves.
However, that doesn't help you a lot at this moment. I've written in answer to many other questions here that it is very seldom profitable to fight with your advisor, even when they are clearly wrong, as here. In the end, you might have to yield on this in order to graduate and get on with your career. He holds an inordinate amount of power over you at the moment.
Let me suggest, however, that you might be able to defuse the situation if you can find allies among the students or other faculty to intervene in this on your behalf. It is hard to fight against powerful people alone. Even if someone else knows of your situation, a faculty member, it would, perhaps, make retaliation against you more dangerous for the advisor. In reality, they should let you publish with proper authorship and graduate based on qualifications. If they do anything else, then it would be appropriate to bring an action against them.
But, I suggest that you don't make a formal complaint based only on threats of bad action. Choose as you think best about the advisor's demand, and if he then takes action against you in any way, complain to whatever authorities are open to you.
You might be able, also, to find some middle ground, such as offering to help this other student in some other way than giving them authorship that isn't proper.
No one can promise that anything but submission will result in a successful outcome for you. Having a paper with a phony author is still having a paper, which is a good thing. It won't be your last paper. It likely, over your career, won't be your best paper. Don't let the short term considerations negatively affect your long term career goals, even if you have to submit to an unethical advisor. Get done. Get gone.