Legally speaking you are mixing two concepts.
Businesses and organizations that are "open to the public" are not allowed to discriminate based on suspc ft cfflassifications (race, gender, sexuality, ethnicity, creed, religion). That's provided by the Civil Rights Act, which was held constitutional in Heart of Atlanta Motel v. US (holding US could regulate discrimination in private businesses because of the aggregate impact on interstate commerce)
There are limited exceptions where a business or other public organization can discriminate, if it is essential to the nature of the business (known as a bona fide occupational qualification). This is why Hooters can refuse to hire male servers, and why white people cannot force employers to hire them as hibachi cooks.
Private clubs that are not generally open to the public can discriminate on whatever basis they want, regardless of whether it is related to their purpose. This is the constitutional right to freedom of association.