As I understand the laws of this country, yes.
As long as it is a "personal" reccommendation.
I'm in IT. I sometimes write letters for folks whom I've worked with, to help them get jobs.
I could decide to only write such a letter to a white, stacked, beautiful young woman, if I so chose. And I would have broken no law.
Stacked and beautiful you could get away with. Where you would run afoul is the white young and woman. There is no way one can twist this as personal. It is his position in the university and his job as the student's professor that gives the letter of recommendation credence. You can't separate the letter from his job. This guy would be toast in court.