Yes, you could buy a stock on the day of its IPO.
I'm a college student, and I wonder if I can buy stock from a company
right after it finishes its IPO?
Yes, you can. However, unless you are friends or family of an employee, chances are you'll be paying a higher price than you think as there is generally a fair bit of hype on most
IPOs that allows some people to "flip them" which means someone is buying at a higher price.
If I am not allowed to buy its stocks immediately after they go on
sell, how long do I have to wait?
Generally I'd wait until the hype dies down as if you look at most historical IPOs the stock could be bought cheaper later but that's just my perspective.
And also who are allowed to buy the stocks at the first minute they
are on sell?
Anyone but keep in mind that while an IPO may be priced at $x, the initial trades may be a few times that value and the stock may come down over time. Facebook could be an example to consider of a company that had an IPO at one price and then came down for a little while on its chart over the past couple of years.