Can a restaurant bar a person from entry based on a dress code violation ("no trainers/sneakers", for example) that they do not enforce amongst their own staff?
Yes, barring any statutory prohibitions against such a rule. I would be very surprised if any existed. They don't exist in any jurisdiction I'm familiar with. Look up the local by-laws to be sure.