If ever there was a Cinderella story in the competitive world of book-writing, this is it: Bill Diehl, 53, writing a first novel last year about a Georgia politician willing to condone murder in his push for the presidency, was flat broke. Diehl's Atlanta home was about to be offered at public sale for non-payment of taxes. His telephone service was about to be cut off.

Then, suddenly, he got rich.

"I couldn't write for two months - I just looked out the window and laughed," recalls Diehl, whose slambang novel about power and corruption, Sharky's Machine, was bought by Delacorte Press last year for $156,000, plus added sweetners. "I was calling to make reservations to go to New York to sign the contract when my phone was cut off. A week before I would have gotten mad, but I just laughed."

Overnight Diehl found he could afford to laugh. In addition to the advance for his novel, he signed a contract for two more books for $800,000. This week, accompanied by a $50,000 ad campaign, Sharky's Machine will be published. Diehl will learn if the public is as excited about his book as publishers and movie agents - Irving "Swifty" Lazar offered to sell movie rights for no commission just because he expected the sale to be "interesting".

"It's a total fantasy come true," marvels Diehl, who worked as a reporter, free-lance magazine writer and producer of grade-B movies in Atlanta for years before he finally decided to write a novel. After seeing the movie "Rocky," Diehl felt if Sylvester Stallone could scratch his way to the top, so could William Diehl, son of an electronics engineer who once helped install the radio equipment in Lindbergh's airplane. While on jury duty in 1976, Diehl began writing his novel in longhand, a style recommended to him by Truman Capote. Once, while profiling Capote, the author learned Diehl wrote on a typewriter. Diehl told Capote he thought too fast to write in longhand.

"Then, William," pronounced Capote, "you're going to have to either learn to think slower or write faster because writing in longhand gives it the right . . . patina."

It's not patina that made Diehl a suddenly successful author; he wove a story with the specific goal of making every chapter crackle with sex, violence and corruption. Book-of-the-Month Club chose Sharky's Machine as a featured alternate, a British publisher bid $120,000 for reprint rights and other countries are waiting in line. To depict scenes in Hong Kong, Diehl spent three days in a department store travel section looking at travel folders. He used the names of some real people, including Hubert Humphrey and Jimmy Carter, as background. The British publisher, however, asked him to substitute phony names because they feared their readers would get confused, mixing fact with fantasy.

White House image-makers who might worry that a fellow Georgian has written an unkind roman a clef about Jimmy Carter can rest easy; the character is hardly in the Carter mold, and dies in the end anyway.

Diehl is like a schoolboy when he talks about his new money. He bought a house, car and part-interest in an Atlanta movie theater. He began traveling with his second wife and their daughter. And the bank officer who once turned him down for a car loan took William Diehl, author, out to lunch to discuss structuring trust finds.