A BAD JOKE going around last week suggested that a high-powered literary agent had called Hamaas Abdul Khaalis in the B'nal B'Rith building and told him not to come out - at least not until he'd finished the first three chapters of his memoirs.

Of course it's not funny, but neither is it unimaginable these days that such a thing could happen as publishers, writers and agents bid, probe and plot to exploit the headlines and transform them into best-selling books. This month's Playboy magazine contains an interview with the late Gary Gilmore. The convicted murderer who asked to be executed became a symbol of the moral dilemma posed by capital punishment, and then signed on a literary and movie agent before being shot by a firing squad.

Last Thursday it was revealed that the Italian auto mechanic who hijacked an Iberia airliner and had himself and Europe gave the manuscript of his autobiography to a reporter several months ago. He called up the journalist the night before the hijack and told him to watch the next day's headlines for the final chapter.

But according to agents and publishers who have dealt with similar books, headlines are not enough to make such nearly unforgettable elements of spectacle and deal with issues or groups that are of abiding interest to a vast number of people.

When the Hanafi Muslims were holding more than a hundred hostages in three Washington buildings, there was, as might be-expected, a flurry of publishing interest. Stein and Day and other publishers contacted WTOP reporter max Robinson about a book on Khaalis. Robinson declined. (Stein and Day says it is still interested in a serious examination of the Hanafi movement, but has not yet found a writer.)

Bantam discussed the possibility of an instant paperback with reporters from The Washington Post. Sixty-one such "extras" have been produced by Bantam over the years, from the Warren Commission Report to the Presidential Transcripts, 90 Minutes at Entebbe, and most recently, Redneck Power: The Wit and Wisdom of Billy Carter. But when the siege ended peacefully, Bantam decided against such a venture. Editorial Director Marc Jaffe explained, "The way this breaking the story developed, it would not have the kind of resonance for three or four or five weeks that would justify the effort." A Washington agent put it another way: "I know it's horrible, but if Khaalis had thrown the heads out the window like the threatened, every publisher in the world would have wanted it.