It was 3:30 a.m. during one of those all-night filibusters in July 1980, the kind that find senators catnapping on cots in the cloakroom, and questioning their reason for being.

Sens. William Cohen (R-Me.) and Gary Hart (D-Colo)happened to run into each other during a quorum call and the wandered off for coffee. Both were tired and frusterated, "Frankly, I'd rather be in Ireland writing a novel," Hart complained.

Cohen confessed he, too, had always wanted to write a novel, but political careers being what they are, Ireland seemed out of the question. One thing led to another, and before long the two senators were scribbling on a manila envelope the story line of a Washington suspense novel, featuring what else but an ambitious U.S. senator.

"It was like ping pong," says Hart. "We started with terrorism. It was topical. Then we asked one another, 'What if? What if terrorism reached this country? What if there was a Senate investigation? The characters just popped up.'"

"Within about 25 minutes we wrote an outline that never changed," Cohen recalls. "It was a spontaneous kind of thing. A lark really. If I hadn't run into Gary that night it never would have happened."

HART had written two previous books; Cohen three, one a collection of his poetry. Their interest in literature, in fact, was one basis of their friendship. They insist the bipartisan novel is their work, and that their staffs had very little to do with it. "We did write it," says Hart. "We have six or eight drafts to document it if it ever comes to that."

It was, however, heavily edited. The first draft was about twice as long as the end product. Editors Tom Allen, Marcia Guarnaschelli and Lawrence Hughes, head of William Morrow, all had a hand in it, says Cohen. "Larry Hughes was tough. He kept telling us, 'You have 80 percent of a good book.' His attitude was, 'I have plenty of good writers, and I'm not going to publish something by two senators unless it is top quality.'"

The novel took four years to produce. Neither senator had time to work on it except on weekends or on airplanes flying back to their home states. Each would write a section and give it to the other. "Our rule was if you see something you don't like, change it," says Cohen.

The bulk of the writing was done in 1981 and 1982. But sometimes a month would pass without either working on the project. To talk about the book, they would slip off on long noontime walks to the Washington monument, away from their staffs, constituents and fellow senators.

Cohen came up with the title, The Double Man, borrowed from a collection of poems by W.H. Auden. But neither he nor Hart will claim credit or blame for any specific character or section.

Sex and the role of Elaine Dunham, the beautiful Senate aide, who Sen. Thomas Chandler, the hero of the book, falls in love with, were sensitive issues. "We'd be less than honest if we said we weren't concerned about how initimate scenes were," says Hart. "As public figures, we didn't want the physical scenes to be too graphic for fear that's all people would talk about."

The sex scenes, for the record (as senators say), aren't much to talk about.

With Cohen facing reelection and Hart running for the Democratic presidential nomination, the novel was set aside in 1984. After the election, each worked on it for about six weeks.

Both are now intrigued by suggestions that The Double Man would make a good movie. Who would play the lead? Not Hart's pal Warren Beatty, says Cohen. "I never thought of Tom Chandler as that handsome."

And what about a sequel?

"I don't see how we could ever get the time," says Hart, who is already gearing up for another run for the presidency in 1988. But who knows. "Most politicians talk about getting out of politics a lot more than most people realize," says the Colorado Democrat.