MANAGUA, Nicaragua (AP) _ Nicaragua said rebels based in Honduras attacked army troops inside Nicaragua and accused an official of Nicaragua's leading business organization of running a spy network for the CIA.

On Wednesday, the Honduran armed forces claimed Sandinista army soldiers attacked the San Agustin military post located six miles inside Honduras a day before. Honduras said the Nicaraguan troops were driven off and that an unknown number were killed.

Nicargua's Foreign Minister Miguel D'Escoto said Thursday the fighting occurred in Nicaragua and that a soldier had been captured and taken to San Agustin.

Responding to a protest note by Honduran Foreign Minister Carlos Lopez, D'Escoto said:

''The crude manipulation of the facts contained in your note reveals the real aim of this campaign - to try to create an incident between Honduras and Nicaragua'' and to undermine peace talks between the leftist government and the U.S.-supported rebels, known as Contras.

''Acts that occurred in Nicaragua are being presented as if they occurred on Honduran soil and ... the armed forces of Honduras takes upon itself crimes that in reality have been committed by the Contras,'' he said.

The Contras have maintained bases in Honduras throughout the 6-year-old civil war. The two sides agreed to a temporary cease-fire on March 23 while they continue negotiations on a permanent truce.

The Interior Ministry said Mario Jose Alegria Castillo, director of the Institute of Economic and Social Research, had worked for the CIA since 1985 and ''organized a network of informing agents in some institutions of the Nicaraguan state.''

Alegria Castillo was detained on Tuesday.

In a statement released Wednesday night, the ministry said Pedro Su Olivas of the Central Bank and Adrian Espinales of the Ministry of Commerce also were arrested.

Alegria Castillo and his secretary, Dora Aldana Centeno, were ''tied to the crime of stealing documents with a secret classification by the Nicaraguan state,'' the ministry said. Mrs. Aldana Centeno was detained briefly Tuesday and released.

The research institute is affiliated with the Superior Council of Private Enterprise and publishes economic information bulletins based on official and private publications.

In a statement issued Thursday night, the Council said Alegria Castillo's detention was ''nothing more than another manuever of the familiar routine'' of the government.

It said Sandinista security agents confiscated several documents from the offices of the council and the research institute, including material published by the Central Bank. The agents warned council and institute employees that ''the possession of this material was illegal,'' the statement said.

Enrique Bolanos, president of the council, said Wednesday the detentions were illegal.