While you can say its an attempt to clean up the image of the league and get away from the "thugged out" look, you can also say that basketball is a sport that is embraced by black culture and the players are mostly black. The players are what make up the league, not the owners and certainly not Stern.
The people who buy tickets and merchandise that financially support the league, and the teams therein, are what matter. Most of these fans are young men or teenagers. While I don't have the demographics in front of me, I'll say that over 50% are black.
So when you set policy that effects mostly black people (players and fans), essentially bans a culture from the sport (Hip Hop), and tries to institute a dress code that matches corporate white America's image of what is right, I'd say it is overtly prejudiced.
The NBA, and basketball as a sport, are a culture unto its own. They sell mass amounts of team merchandise because the demographic it appeals to are the young hip hop crowd. There is no better market than the 18-25 year-old male demographic. They have huge buying power and league sports make fans for life. So as this group of 18-25 year-old ages, they will still be NBA fans and new fans will come aboard in the younger groups.
Why, as a league, they wouldn't embrace this is beyond me. The hip hop culture isn't going away. Why the NBA would choose to alienate it is unfathomable. Quiet simply put, an old white guy should not be running the NBA.