In the small hours of Oct. 15, a squad of mercenaries made up of former non-coms from Britain's version of the Green Berets took a look at Togo's border with Ghana. They did not like what they saw.

The place was crawling with Togolese soldiers and police, searching every vehicle with unaccustomed vigor. This was clearly not going to be a good day to go in and assassinate Togo's president, Lt. Col. Gnassingbe Eyadema.

So the nine-man hit team returned to the Ghanaian capital of Accra, where it was disbanded. In Britain, a backup squad of 14 more mercenaries was left cooling its heels. President Eyadema not only lived to tell the tale, but to announce to a largely uninterested world that he had been saved by a tipoff from "friendly powers."

Just who hired the mercenaries, and why the procurer wanted President Eyadema killed, remains a mystery to this day. But the last-minute tipoff, it is known, came from the British Foreign Office. The sequence of events strongly suggests, moreover, that there was a conflict - or at least a mix-up in signals - between the Foreign Office and the "dirty tricks" arm of the British Ministry of Defense.

The story, which has emerged from interviews in Whitehall, the seat of British government, and from bits and pieces that have gotten into the press here, runs as follows:

The core of the murder team was made up of alumni of Britain's Special Air Services. An elite World War II commando outfit, the SAS has carved out a unique role for itself in post-war Britain. Its expert killers have plied their trade in the Persian Gulf and Ulster, and two SAS men advised the West German commando squad that rescued the Lufthansa hostages in Mogadishu.

Since theirs is a specialized trade with few civilian outlets, discharged SAS veterans are a fertile source for mercenary recruiters.

Enter Tom Finan. A British-trained Canadian soldier and former lieutenant colonel in the Canadian tank corps, he paid out at least $200,000 of somebody's good money to arrange the Togo affair. To lead the hit squad, he recruited a former SAS sergeant, David "Darkie" Davidson.

Finan apparently assembled his two hit teams around Hereford, a sleepy British market town that is home for the one active SAS regiment, the 22nd. Ex-Sgt. Davidson lives there, and his wife is a civilian worker for the regiment.

Before a former SAS member goes off on a paid mission, however, the drill requires that he get an informal OK - "a wink and a nod" - from a serving SAS officer.

Davidson, said to have been a man who always went by the book, told friends that he checked out the Togo operation with serving SAS officers, and was told as late in the game as Oct. 10: "The government has no view on this."

Since Togo is a far-off, French-controlled place of which little is known in Britain, it is conceivable that their one-time superiors gave the ex-SAS team the "wink and the nod." After all, the boys were getting $9,000 each as a down payment - with another $9,000 promised when the Eyadema job was done.

In any event, as late as Oct. 14 - the day before the assassination was to take place - Finan evidently thought there was clear sailing. On that date, he sent a friend in London a postcard from Accra saying:

"Weather here is just excellent . . . Good business and some time to rest."

Little did he know that the British Foreign Office had already moved to abort his caper. Word of the planned coup had been picked up by agents of the Foreign Office's Secret Intelligence Service.

A warning to the Togolese president, Whitehall now says primly, was transmitted through "diplomatic channels" on Oct. 13, just two days before the Eyadem assassination was scheduled.

Foreign Office officials explain that London would have been horribly embarrassed by any link to an African coup at this delicate moment, when the United States and Britain are trying to win friends in Black Africa - no eliminate presidents.

For the record, the Ministry of Defense says it knows of no meeting between Davidson and an SAS officer on Oct. 10 or any other date.

But the entire incident brings to the surface a battle that has been raging between the Foreign Office and the SAS over the mercenary question for more than a year.

The diplomats want a tough law passed that would prohibit the recruitment and use of mercenaries in any country ruled off bounds by the British government.

The military, however, prefers the present law. It was enacted in 1870 and merely outlaws any mercenary traveling by ship. In a jet age, this makes all British mercenaries legal and keeps open the job market for SAS veterans.

If this explains the curious pattern of non-events in Togo, it still leaves unanswered who financed, Finan. Who was behind the plot. Indeed, why anybody bother about Togo puzzles experts here. The place has an oil refinery - but no oil. It does export karite nits, but not very many and they are considered an exotic taste.

To be sure, Eyadema has enemies. Amnesty International has a list of 20 Togolese political prisoners he is said to have had tortured to death last year, and this a regarded as just a sample.

Then there are the friends and relatives of Togo's first post-independence president, Sylvanus Olypio. He was personally shot to death by Eyadema in 1963, a necessary step to Eyadema's elevation to Togo's highest office four years later.

There also are the Ewes, a tribe that always nurses a sense of grievance. Their tribe was neatly divided in half by the post-World War I arrangement that gave Britain what is now Ghana and France what is now Togo. Diplomats here speak darkly of "irredentist" feeling on both sides of the border.

But none of these people are likely to have had the kind of cash Finan was flashing.

Inevitably in Africa, discussion turns to Libya's extremely rich and equally mercurial Col. Muammai Qaddafi. He is said to have made a $3 million gift to the Togolese people that wound up in the pockets of Eyadema's ministers. Indeed, Finan's clean up team in Britain was thought to have counted on help from disgruntled Togolese army officers, upset at their failure to share in the Libyan bounty.

One man, ex-col. Finan, could clear up the whole mystery. It is said here that the Royal Canadian Mounted Police, who are having troubles of their own these days, would like to question him.

But the impression given in Whitehall is that nobody wishes the Mounties much success. Finan's tale would embarrass a lot of people.