A vice consul at the Cuban Embassy in Madrid and three other embassy employes were arrested and ordered expelled from Spain today after a foiled attempt to kidnap at gunpoint an apparent defector described as a high-ranking former Cuban official.

Police rescued the kidnaping target and identified him as Manuel Antonio Sanchez Perez. They said he recently had been granted provisional asylum by Spanish authorities.

An Interior Ministry statement called him a senior member of Cuba's Central Planning Board who arrived in Spain on Nov. 18 and applied for asylum. Police said Sanchez Perez, 41, had been deputy planning minister until two weeks ago.

But Cuban exile sources said that Sanchez Perez had not registered as a refugee with any agency here. They alleged that he was a top-ranking Cuban intelligence officer whose principal role was to act as paymaster for Cuban spies in Spain and elsewhere in Western Europe. The exile sources said that Sanchez Perez apparently intended to defect.

Western diplomatic sources said Sanchez Perez was understood to be "a senior Cuban intelligence officer," but they denied knowledge of his paymaster activities.

According to Spanish press agency reports, Sanchez Perez was surrounded by the four Cuban Embassy members as he left a downtown bank. A crowd gathered as Sanchez Perez began shouting, "They are trying to kill me."

The reports said that in the ensuing brawl, Sanchez Perez was pulled out of a car into which he had been forced and taken back into the bank. The four Cubans were held by the crowd while a taxi blocked their car until police arrived.

The Spanish press agencies EFE and Europa Press said that Sanchez Perez was carrying a briefcase as he left the bank. They quoted bystanders as saying that Sanchez Perez had shouted, "It's not the money, it's the documents that are important," as the crowd struggled to free him from his attackers.

After several hours' questioning at Madrid's police headquarters, the Interior Ministry ordered the expulsion of Vice Consul Angel Alberto Leon Cervantes and the three other Cubans arrested with him.

Madrid city officials said Leon Cervantes was armed with a 9-mm handgun and was arrested following "an attempt to kidnap" Sanchez Perez. They listed the other Cubans arrested as Abelardo Lopez Hernandez, who was armed with a .38-caliber revolver and who was described as an embassy clerk; Ramon Burroto Chavez, another embassy clerk, and Ventura Ventura Torrientes, identified as a teacher with the embassy.

A Foreign Ministry spokesman said Cuban Ambassador Oscar Garcia Fernandez, who was detained in Barcelona by an air controllers' strike, had been summoned to the ministry. The spokesman said a protest note was likely.

An Interior Ministry spokesman said tonight that Sanchez Perez was under police protection.

An official Cuban statement said the four diplomats were really capturing an embezzler, Agence France-Presse reported from Havana. The statement said Sanchez Perez was seized because he had deposited $499,000 of Cuban funds into his account at the Madrid bank.

[Sanchez Perez was not a refugee, but an official of the Cuban State Committee for Technical and Material Supplies, the statement explained. He had been in Spain since Nov. 16 in charge of some trade negotiations, but embassy officials had discovered financial irregularities on his part.]