THIS IS THE way the story goes: King Hassan of Morocco was talking with some Libyans one day in July and suddenly it occurred to him to join the two countries in a political union. "I was personally surprised by myself while talking," he later claimed. Libya's Muammar Qaddafi received his proposal "with amazement," but, having made six earlier (and unsuccessful) tries for union with other Arab countries, soon agreed. Col. Qaddafi's people's congresses approved, unanimously, and King Hassan scored 97 percent, or 99.99 percent, whatever, in a referendum.

Let us stipulate that the improbable alliance between the conservative and moderate Hassan and the radical, brutal Qaddafi could come apart overnight. Keep in mind that the Libyan dictator once mounted a radio campaign urging Moroccan soldiers to overthrow the king, who responded with a single nonstop 24-hour counterbroadcast of dogs yapping. Different as they are, the two men have in common their impulsiveness and a bent for tactical maneuver. King Hassan's guiding calculation seems to have been to end Libya's support for the Polisario rebels, who have been contesting Morocco for control of the Western Sahara for nine draining years. Col. Qaddafi's purpose is . . . who knows? He is guided by spirits inaudible to the normal ear.

The union's impact on regional affairs could be substantial. For instance, will Morocco be able, as it suggests in its behind-the-hand rationales for the union, to tame Libyan troublemaking in places such as Chad? Or -- seemingly much more likely -- will Libya ignore counsels of moderation and perhaps even draw Morocco into a degree of support for its regular depredations? Just the other day it was disclosed, partly by Col. Qaddafi, that he had launched and then aborted a plot by Libyan "pilgrims" to seize the Grand Mosque in Mecca -- a caper that could have convulsed the Arab world.

American officials are embarrassed to find one of their favorite moderate Arabs giving political aid and comfort to a regime they fairly regard as a scourge. They should be embarrassed, by the evident intelligence failure and by the spectacle of a friend's fickleness. But should they take it out on Morocco, as some suggest, by trimming the annual $140 million in American aid? The new union cuts across the American effort to isolate Col. Qaddafi but serves the Western interest in moving the grinding Sahara dispute toward political resolution. If there is a partially redeeming value to this bizarre reversal of regional alliances, here is the place to seek it.