Ray Charles and Dr. John (Mac Rebennack), two well-known and much-praised artists, share a similar problem on their otherwise enjoyable new albums.

Without exception, the songs they perform in their own inimitable and even classic styles are joyful celebrations of their continuted growth. But the mass record-buying public, which once raised them to star status, has now seemingly passed them by. So each has included a few songs on his album that are uncomfortable, off-the-mark attempts to imitate the kind of music now in the public eye.

Ray Charles has been able to try all sorts of songs in his style, from blues to country to "America, the Beautiful." And there is a least an optimistic, what-the-hell attitude when he tries "Some Enchanted Evening," disco-style.

Dr. John's performance of his obligatory disco and hard-edge funk offering, however, seem bitter and shallow to the point of being self-destructive. He seems to be saying: "If this is what you want, take it. If it isn't, well, just wait." It is worth the wait, as it is with the Ray Charles album. But it's hard to say how long an artist can place these kinds of demands on listners who enjoy their music.

Ray Charles' moving reading of the Johnny Mercer and Harold Arlen standard "Blues In the Night" has gotten some airplay for the album, "Ain't It So" (Atlantic SD 19251). On the strangest songs one could imagine, he is able to match precisely articulated pop lyrics with the wrenchingly melismatic song voice of a high baritone gospel singer. It continues to be one of the wonders of our music.

Always a structurally surpising song -- it's no wonder that many jazz saxophonists include it in their repertories -- Charles' "blues In the Night" is majestic from the beginning when he somehow transcends those old-fashioned, pseudo-ethnic first 11 words by compressing his phrasing during the first line and adding a surprise emphasis to the second: "My momma done told me /When I was in kneeee pants." It's awesome now the old chestnut comes to life under Charles Svengali vocal trance.

The singer himself engineered and produced the album, and maybe the only reason the disco-ized "Some Enchanted Evening" doesn't work (regardless of the bizarre tie-up of a quintessential Broadway musical tune to a disco tempo) is that he simply doesn't know how to mix the tune.

The drums and electric bass are put in the background, as if in a Count Basie session. There's no thump, and what is disco tune without those brain-bashing four thumps to the bar?

Luckily, most of the other songs on the album are right on the mark, particularly a new one, "Love Me or Set Me Free," which has all the fire of the singles he did right before his "country" phase with ABC records. Back with Atlantic again, his first major label, he seems to be including a few outright R&B tunes on his albums along with the pop-soul songs, almost as if he wishes to put himself into perspective.

Dr. John, on his "tango Palace" LP for the ill-fted Horizon label (SP 740), distributed by A&M, has made an album that includes some great songs (the title song and several others) prefaced by several losers that disco fans won't like because they reek of contempt for that music. And they surely won't like the rest of the song, because they are celebrations of the New Orleans musical experience. This album challenges the listener to sift through the initial junk to get to the treasure.

And there's no doublt that the artist thinks its junk, either -- the callow and jaundiced lyrics and music of the so-called plug cut (not written by Dr. John) say: "Keep that music simple -- that's where the money's at." And the melodic hook, to grace the line, is a direct cop from Wild Cherry's already cliche appropriation of the "Play That Funky Music, White Boy" riff. It's a bitter and upsetting parody.

Once past those songs, however, it's as if it were another album entirely. Dr. John serves up some of the best musical fare -- all of his own writing -- since his classic "Gumbo" LP for Atlantic, an excellent re-interpretation of the songs of then little-known New Orleans masters of rhythm and blues.

Particularly enjoyable is an original tune called "I Thought I Heard New Orleans Say." The title is a tip of the hat to the city's unrecorded trumpet legend, Buddy Bolden, who has a song written about him similar only in the title.

The tune pays tribute to Antoine "Fats" Domino, Mardis Gras music ensembles, Professor Longhair (godfather of all the R&B to follow from that city) and others.

Also stirring is a lovely song with patois lyrics appropriately called "Louisiana Lullabye," which begins gently, and even as it broadens into a "big beat" song, still holds to its grace.

The title song -- at least Dr. John lets us know that this song is the album's heart -- is a patently melancholy tango that speaks of "old timers . . . pretending Latin ancestry . . . low branch on the family tree," who despite their pretensions feel to the soul of the tango.

"Never does no disco dancin'/Never tries to rock and roll/ Says that kinda dancing that the doin'/Just ain't got his kinda soul/He loves to do the tango, tango, tango."

It is an obviously sentimental song, but it takes you somewhere sad and strangely wonderful.