ELVIS PRESLEY'S first national television appearances and hit records were controversial because they challenged the conventional sexual and racial attitudes of the mid-50's. Mr. Presley flaunted his sex appeal more flagrantly than any white pop performer before him, and he introduced black rhythms and inflections into the American pop mainstream, making it possible for black rockers like Little Richard and Chuck Berry to appeal to white teen-agers directly. Today, of course, attitudes toward race and sex tend to be considerably more liberal. Or do they?

Prince, the 21-year-old singer, songwriter and multiinstrumentalist who is performing tonight at the Palladium, is the most controversial contemporary rock star precisely because he challenges sexual and racial stereotypes. The songs on his four Warner Bros. albums explore adolescent sexuality in language explicit enough to require warning stickers (''contains language which may be unsuitable for some listeners''), but the stickers haven't kept his records off the best-seller charts. And his music confounds racial categories by combining elements of white pop and rock with black dance rhythms.

How rigid are racial categories in contemporary pop music? Prince recently found out when the Rolling Stones invited him to open several West Coast concerts on their 1981 tour. The suggestions of androgyny in his fluid body movements and flamboyantly minimal stage costume were more than a little reminiscent of some of Mick Jagger's early performances, but the almost entirely white Stones audience apparently failed to make the connection. They pelted Prince with fruit and bottles, causing him to cut his sets short. Similar reactions from white radio programmers have kept Prince's records off most FM rock stations; it's the stations with black music formats that are playing them. 'Dirty Mind' Is 3d Album

Prince's mixed black-Italian parentage and his upbringing in a racially integrated neighborhood in Minneapolis contributed to his genuinely biracial musical approach and outlook. The fact that white rock fans and radio stations have tended to banish him to the blackmusic ghetto says more about racism in contemporary pop music circles than it does about Prince's songs or his presentation. And their resistance has been crumbling; Prince's third Warner Bros. album, ''Dirty Mind,'' sold spectacularly and spawned a hit single, ''Uptown,'' and his latest album, ''Controversy,'' gives every indication of equaling and perhaps exceeding that performance.