Should I recommend a student with a bad ideology? My problem is the following: I teach  an honors course in an engineering discipline at a small university. (It is not exactly that, but "teaching an honors course" is a good approximation to what I do). Large US companies sometimes ask me to recommend the best students for an interview, and they are often hired. The policy of the University in general is that it doesn't discriminate on political opinions or religious beliefs or anything of that sort. 

Now, I have a student who is a very nice person and has a great academic record but he supports an ideology that many would find abhorrent. (Again, this doesn't mean he is a bad person. For example, the famous mathematician and Fields Medalist Stephen Smale supported Stalinist communism in his youth, in reaction to unjust practices in the US:
http://www.ams.org/notices/200011/rev-kirby.pdf   ). 

Now, if I recommend him, I think there's a reasonable chance he gets hired because he's pretty good in technical matters. But then I think he might really get into problems there because he supports his "bad" ideology in a rather ostentatious manner, and I'm afraid that this will reflect badly on me and on my ability to recommend other students. I'm pretty sure the overwhelming majority of employees would be hostile to his ideology.

Mind you, I wouldn't have hesitated for a second to give him a recommendation for graduate study, people are usually much more understanding of that sort of stuff in academia, and the only person he really would have to please in that case is his advisor, and if the student's research is good, the advisor would probably forget about all the rest. But working in the industry necessitates interaction with a lot of people, and I think his ideological views may cause problems.

What do you think I should do ? Recommend him or not ? If I don't, I feel it would be a kind of betrayal; especially since he wouldn't even know why he's not getting the interview some people less qualified than him are getting. I also have the impression I'm not the only one to have this issue with him, as he has been already "overlooked" for several positions where less qualified people succeeded.
As stated in the other answers, no-one can coerce you to provide a recommendation, you are free to not recommend a student for any reason you choose, or no reason at all - if you are not comfortable recommending this student, then don't.

However, from your description, I would suggest that it's not the ideology at issue, but the student's interpersonal skills. I guarantee you that I have opinions that you would find absolutely abhorrent, and you have opinions that I would likewise. The point is that in a professional context we usually have the good sense to keep these things to ourselves. 

It's not clear what your opinion of the student, and their suitability for the role, actually is. If you think that the way he expresses his ideology interferes with his ability do the job well, or his ideological standing is in some way relevant to the job at hand, then there is no conflict here. (For example, a raving misogynist would be completely inappropriate in a supervisory position.)

If you think that he nevertheless really would be an asset to the company, then you can either (i) informally suggest to your contact: "Here is a brilliant student who will produce technically excellent work, but be careful; he has a bit of a problem with appropriate boundaries at work." and/or (ii) write a letter that expresses his technical skills and omits any mention of personality or social skills. The omission will be  loud and clear. In the end, it is up to the company to decide if the tradeoff is worth it.