There are two situations to consider: In the first situation, the student has not done anything wrong. If it was a private establishment, as in https://law.stackexchange.com/questions/52427/can-the-manager-of-a-commercial-establishment-forbid-someone-to-enter, a manager could forbid someone to enter at his own will. But I believe this case is different. In the second situation, the student did something wrong that, in principle, could support the decision. But the student is not informed of this reason. He is simply banned from entering the building. (I am primarily interested in the case the university is in Canada, but I would be interested in how it works in different jurisdictions.)