Is this a serious question?
Okay, example: If a university hires a black professor or a white professor, all other things being equal, what practical difference does it make to anybody? Pretty much none at all. If a university hires a stupid professor instead of an intelligent professor, all other things being equal, what difference does it make? The teaching quality and research quality of that department is probably going to plummet.
On the other hand, if I work at a restaurant, and I tell a group of people "Sorry, you can't eat here, you're all too stupid", then that would be frowned upon, because whether they're stupid or not doesn't make any difference to anyone. They're there to eat, which doesn't require much intelligence.
Similarly, if I tell a group of black people "sorry, you can't eat at this restaurant because you're black", it would be frowned upon for the same reason.
On the other hand, if I'm hiring actors for a film, and I tell someone "sorry, you can't play the character of Harry Potter, you're black", that would be seen as perfectly acceptable.
i.e. it is okay to discriminate on certain traits which are actually relevant or make a materal difference in the context in question. Whereas discrimination on traits purely based on prejudice is frowned upon.