I don't think the two equate. Refusing to sell to a "class" of people isn't the same as refusing to sell to someone who's trying to skirt the law and create liability/ris for you (warning signs of straw purchase) or selling the item to the person would result in harm (ie, selling a gun to someone who's showing suicidal indicators).
It's direct analogous to profiling. Racial profiling is both ethically wrong and ineffective. Behavioral profiling is how hard wired into us or we wouldn't survive and is foolish to ignore.
So do you want a law where private business owners are required by the government to sell to those it does not want to?