Should I not hire someone who does not get along with me? When I was doing my postdoc, there was a PhD student who shared the same office with me; he didn't get along very well with me or anyone in the office. He could be described as unfriendly and a little bit rude.

As we were working on different projects, I didn't know much about his research ability. 

I am now a lecturer (at the same university) and have just received funding to hire a postdoc. The same PhD student applied for the position and has since been shortlisted along with another candidate. Based on the CV alone, the PhD student is comparable to another candidate. However, based on his behaviour in the past, I don't want to consider him for the job (my department lets me make the final decision who to hire).

Is it ok to not hire someone because, from past history, I believe that we will not get along?
This question is fascinating to me on many levels. It shows a weird tendency that we have in academia to equate job offers to something like awards, where the decision for or against a candidate has to be based on scientific (or educational, or whatever) merit alone. I argue that if you posted the question "Should I not hire someone who does not get along with me" over at Workplace.SE, you would get very confused people asking you why you would even consider such a thing. 

To answer this very frankly - no, you should not hire a person that you suspect you will not get along with. Not over an equally qualified person  that you might get along with better, and arguably not even over a slightly less qualified person that you might get along with better. Your main metric for deciding for or against a candidate should be how good you think he will be able to do the job. For a postdoc under your guidance, your suspicion that he will not get along with you means that he will likely not do a good job. That he might do a good job working under somebody else is not relevant to this decision.