What to do about referral for student I would not recommend? In my field (computer science), students often get jobs through referrals, where faculty members pass on the student's resume to someone employed at the company the student wants to work at. In an annual talk and throughout the year, I advise my students to use referrals if at all possible rather than applying online. I accept LinkedIn requests from my students and encourage them to ask me for referrals.

There is currently a student in our small program who has negatively impressed all of the professors he has taken classes from, as well as many of the students. He is not the weakest CS student, but, in my opinion, he is the worst at getting along with others and behaving professionally.

I am wondering what to do when he asks me to refer him to companies (which I expect him to do). In the past, when a weak student has asked for a referral, I have said that I don't think they're ready for the job in question [due to their technical level], recommended that they ask a different professor, or refer them without an explicit recommendation (e.g., "Jane Doe asked me to refer her to SlackJaw.") I am hesitant to do the latter for this student because I don't want to hurt my or my school's reputation by putting forward a candidate who behaves inappropriately. I also dread his reaction if I decline to refer him for a job. I expect that he would get angry and allege persecution. (I'm a tenured full professor, so my job wouldn't be in danger if he complained about me, but I'd rather not get in that situation.) 

In any event, I don't want to hurt his chances of getting a job. I'm happy to give him job-seeking advice and help him with his resume, but I don't want to recommend him.

What should I do if he asks me for a referral?
Why do you dread his reaction? You have no responsibility of giving anyone a referral. I doubt "this professor did not write me a referral" would stand as an excuse to allege persecution in any tribunal.  Don't get bullied by a student, just plainly refuse to do a referal if you are not up for it.