That should be legal.
I certainly don't approve of it, but there is no rational basis whatsover to compel them to give custom.
It is worth noting that during the time of Jim Crow laws commonly made such discrimination mandatory - that is equally unacceptable intrusion into the property rights of a business owner.
The free market is a voluntary exchange of goods, services, and property. The government has no business interfering with such voluntary exchanges.