GIBRALTAR (AP) _ One of four British soldiers who shot and killed three unarmed Irish Republican Army guerrillas in March denied Wednesday that his commander sent the anti-terrorist unit to eliminate the guerrillas.

He testified before a court investigating whether members of the Special Air Services were justified in killing the guerrillas, who the IRA has acknowledged were on a mission in this British colony.

''Our only intention was to arrest (them),'' said ''soldier B,'' hidden from public view by a curtain for security reasons.

A senior British intelligence officer has testified at the inquest that the soldiers believed the three were armed and were planning to set off a car bomb during a changing of the guard ceremony.

''(The IRA members') movements precipitated our action,'' he said. ''I believe with the information we were given, we did the correct thing.''

The officer testified on the seventh day of an inquest by Coroner Felix Pizzarello and an 11-member jury into the March 6 shooting deaths of Sean Savage, 24, Mairead Farrell, 31, and Daniel McCann, 31.

Patrick McGrory, the attorney for the families of the IRA members, suggested to soldier B that their tactical commander, identified only as ''soldier E,'' sent them out on the anti-terrorist mission ''with the impression that the suspects were too dangerous to be allowed to live.''

During questioning, the McRory challenged soldier B:

''You were told to go out and kill (the IRA members) and the task was made so plain to you that you feared no legal retribution for your actions.''

''No,'' the soldier responded.

The three guerrillas proved to be unarmed when the soldiers opened fire on them near a gas station in Gibraltar. Critics of British Prime Minister Margaret Thatcher's government cited the shootings as evidence that her government is implementing an unofficial ''shoot-to-kill'' policy against IRA members believed to be on missions to attack British targets.

Spanish police found a car linked to the IRA and loaded with 141 pounds of explosives and a timing device in the Spanish resort of Marbella two days after the shooting.

The inquest has no power of prosecution against the seven men who formed the unit that took part in the operation against the IRA members. If the jury hands down a verdict of unlawful killing, the Gibraltar attorney general is expected to return criminal indictments.

The predominantly Catholic IRA is fighting to oust the British from Northern Ireland and to unite the province with the mostly Catholic republic of Ireland.

In another incident on Wednesday, police arrested a British man when he tried to enter Gibraltar from Spain in a van with British license plates.

Chief Inspector Glen Viagas said the man, accompanied by a woman, a teen- ager and a child, was arrested after customs officials searched his white Leyland van and found a .22 caliber pistol, six rounds of ammunition and 16 canisters believed to hold tear gas and a gas gun, Viagas said.

He said the man, whom police did not identify, carried a British passport and is believed to be from Scotland. He was taken to a Gibraltar police station for questioning.

Viagas said the arrest did not appear to be connected to the inquest.