THE history of rock-and-roll is essentially a rags-to-riches story. The music of poor whites and poor blacks merged in the mid-50's to become the most popular music in America. Performers from poor or middle-class backgrounds have risen to undreamed-of pinnacles of stardom and earned substantial fortunes through rock-and-roll, from Elvis Presley, who was living with his parents in Federally subsidized housing in Memphis when he made his first record, to Rod Stewart, who grew up in working-class North London, the son of a Scottish-born construction worker. Mr. Stewart, who is now 36 years old, supported himself as a street singer and gravedigger before becoming one of the most popular and distinctive rock singers of the 70's. He now lives as a tax exile from Britain in the exclusive Holmby Hills area of Los Angeles, where his neighbors have included Gregory Peck and Burt Reynolds.

The relationship between material success and musical creativity seems to be particularly problematic for rock stars; there is such a thing as too much success. Elvis Presley's music grew more predictable after he became a multimillionaire. Mick Jagger's entry into the upper crust of jet-set society in the mid-70's compromised the Rolling Stones's credibility and coincided with the band's musical nadir. And Rod Stewart has been attacked by critics and younger rock musicians for his lavish Hollywood way of living, which reached a pinnacle of sorts during the late 70's when his former girlfriend, Britt Ekland, sued him for $15-million in ''palimony.'' A Fall From Grace

Mr. Stewart's responses were an out-of-court settlement and a phenomenally successful album called ''Blondes Have More Fun'' - the title referred to his penchant for blondes, from Miss Ekland to Alana Hamilton, the actress he married in 1978. The album included a song called ''Da Ya Think I'm Sexy?'' that became a huge international hit but was also a fall from rock-and-roll grace into the banal shallows of disco. It was seized on by Mr. Stewart's detractors as proof that his songwriting had deteriorated markedly since the early and middle 70's, when he wrote or co-wrote ''Maggie May,'' ''Tonight's the Night,'' and several other songs that were artistic triumphs as well as commercial successes.

But like the Rolling Stones, who bounced back this year with a superb new album and an American tour that has been garnering enthusiastic reviews at almost every stop, Mr. Stewart seems to have found his second wind. ''Tonight I'm Yours'' (Warner Bros.) his new album, is his most consistent and satisfying LP since the early-70's when ''Gasoline Alley'' and ''Every Picture Tells a Story'' established him as one of rock's most gifted singers and song writers. When he visited New York recently to perform on ''Saturday Night Live,'' he brought along the most impressive band he has ever led. And he readily, if somewhat ruefully, admitted that these improvements were a response to what many of his fans had recognized as a deterioration in the quality of his work.

When he was asked about ''Da Ya Think I'm Sexy?'' Mr. Stewart grimaced. ''A lot of us got taken in by disco,'' he said. ''I drifted further and further away from rock-and-roll, in my music and in the way I was living.''

Mr. Stewart's marriage, his first, seems to have been a turning point for him. He was once a renowned drinker, and when he was living with Miss Ekland, his life sometimes seemed to be a ceaseless round of Hollywood parties. His music had put him on the cover of Rolling Stone in the early 70's; his celebrity status put him on the cover of People Magazine in 1979. He has drastically cut back on his drinking since then. And according to his wife, ''We hardly ever go out now. We'd rather stay at home.''

In New York, the Stewarts got around more. The night before his performance on ''Saturday Night Live,'' Mr. Stewart visited the Ritz to hear Tina Turner, who donned a thatch of blond, ersatz hair - a Rod Stewart look-alike wig - and sang several of his songs. On the spur of the moment, he invited Miss Turner to sing a duet with him on ''Saturday Night Live.'' The song, ''Hot Legs,'' was a frothy piece of self-delectation the way Mr. Stewart and his band of the late 70's performed it. Miss Turner made it genuinely sexy; Mr. Stewart even took a stroll off-camera to give her center stage. ''Let's face it,'' he said later, in the midst of a late-night party at Studio 54, ''rock-and-roll is basically about sex.'' Two Other Ingredients

Later still, during an early-morning conversation at the midtown hotel where the Stewarts were staying, Mr. Stewart amended that statement. ''Musically,'' he said, ''what you also need to make good rock-and-roll is a good bass player and drummer.'' He has them in the bassist Jay Davis and the newly recruited drummer Tony Brock. In the past, Mr. Stewart's bands tended to overplay sometimes to the point of unintentional parody. His present group is rhythmically assured, well-stocked with inventive soloists, and notably lacking in inflated egos.