Prejudice had to be against alien species

Paramount
The Starfleet officers on “Star Trek” are all ostensibly enlightened folks, capable of interrogating their own personal weaknesses and overcoming any of their own neuroses or personal foibles. It would be inspiring to watch Starfleet officers overcome prejudices from time to time, as they were all wise enough to know, eventually, when they might be operating from a place of hate. Of course, for that to happen, they would require a few deep-seated prejudices to begin with.
This is where aliens come in. No one in Starfleet is ignorant enough to hate someone based on their race, their job, their age, their gender, their sexuality, or their station. Class is no longer an issue because “Star Trek” is set in a post-capitalist society. But when it comes to aliens, the human characters can be written as, at least temporarily, a little prejudiced. One can see interspecies racism all the time on “Star Trek.” Dr. McCoy (DeForest Kelley) infamously mocked Spock’s half-Vulcan heritage all the time. Kirk (William Shatner) admitted in “Star Trek VI: The Undiscovered Country” that he never trusted Klingons, especially after a Klingon killed his son.
The infamous episode “Let That Be Your Last Battlefield” (January 10, 1969) saw a pair of near-immortal aliens named Bele and Lokai (Frank Gorshin and Lou Antonio) who were half-white and half-black, bisected down the middle. They hunted each other for centuries merely because one of them was black on the right side and the other was white on the right side. That episode, quite obviously, was about the absurdity of prejudice.
That approach continued into the “Next Generation” days as well. Ferengis were all untrustworthy. Romulans were all devious. Klingons were all aggressive. Roddenberry and his writers hardwired some prejudices into his show, taking care that our stereotypes were only ever against aliens.
Despite everything, we learn to outgrow our prejudices

Paramount
Of course, now that the prejudices were in place, the “Star Trek” writers set about overcoming them. Ferengi characters may have been described as untrustworthy, and Ferengi engaged in their share of dastardly behavior, but that didn’t mean that all Ferengi were evil. Indeed, in the “Next Generation” episode “Suspicions” (May 9, 1993), Dr. Crusher (Gates McFadden) found herself boosting the research of a Ferengi scientist, and understood that Ferengi scientists are rarely respected by dint of their species. In “The Wounded” (January 28, 1991), Chief O’Brien (Colm Meaney) admitted that he hated Cardassians, but later had to admit it was because he associated the species with his war trauma. Prejudices could exist in “Star Trek,” but they only existed to be overcome.
This interspecies prejudice, perhaps conveniently for the “Star Trek” writers, allowed them to skirt the lines of the no-interpersonal-conflicts rule. Starfleet officers were enlightened and always got along, but they could still have character flaws. Even the show’s alien species protagonists followed the same pattern. Worf (Michael Dorn), a Klingon, expressed perplexity over his interactions with humans, but never noted that he hated or resented them. He was allowed to hate all Romulans because of longstanding cultural resentment. Worf was eventually forced to reconcile his feelings in “Birthright, Part II” (March 14, 1993).
To be sure, if O’Brien had to work with a Cardassian Starfleet officer, or Worf had to work with a Romulan Starfleet officer, their interpersonal conflicts would be deleted entirely. They are now equals in the workplace, and would respect one another.
So prejudice could still be a part of “Star Trek,” and the Roddenberry Rule could remain intact. It’s vital to note, though, that racist attitudes had no place on a Starfleet vessel. If you find you had prejudice, you will work to overcome it post-haste. I just wish Dr. McCoy had apologized to Spock at least once.