MANILA, Philippines (AP) _ President Corazon Aquino announced today that her closest adviser, Executive Secretary Joker Arroyo, was leaving the Cabinet, but said the government would ''hold fast'' to ideals he represents.

Arroyo's removal was long demanded by business executives and military groups, including one that led a bloody aborted coup on Aug. 28. The military said Arroyo was sympathetic to Communist rebels, a charge he denied.

Meanwhile, Chief of Staff Gen. Fidel Ramos said Philippine authorities were looking into possible foreign involvement in the military mutiny. U.S. authorities have denied any role.

Ramos, whose removal had also been demanded by mutineers, said in a television interview that the military was investigating the presence of ''some foreign personnel'' near armed forces headquarters during the coup attempt.

''We are looking into what may be participation - although they could just be observing - of some foreign personnel during the time that these actions were taking place,'' Ramos said without elaboration.

Mrs. Aquino's announcement came after she met with Gaston Sigur, U.S. assistant secretary of state for East Asia and Pacific affairs. He gave her a letter from President Reagan reaffirming U.S. support of her government.

Mrs. Aquino called the Arroyo's departure ''our loss and the nation's.'' The 61-year-old human rights lawyer was widely believed to be the second most influential figure in the administration after Mrs. Aquino.

Arroyo resigned along with the rest of the 25-member Cabinet on Sept. 9, but it had been expected many officials would be renamed to their posts.

Officials said the Cabinet resignations were aimed at allowing Mrs. Aquino to reorganize her government following the coup attempt, which plunged the 18- month-old administration into its gravest political crisis.

The president named Catalino Macaraig, Arroyo's deputy, as her new executive secretary. Before joining Mrs. Aquino, Macaraig, 60, was President Ferdinand Marcos' deputy justice minister and vice president of a mining company.

Mrs. Aquino also announced today that speechwriter Teodoro Locsin, who has also been criticized by the military, had resigned as special legal counsel. She said he would remain as a government consultant.

On Wednesday, Mrs. Aquino accepted four resignations, including those of Vice President Salvador Laurel as foreign secretary and Finance Secretary Jaime Ongpin. Laurel said he would refuse to accept another Cabinet post because of ''fundamental differences'' with the administration.

Presidential spokesman Teodoro Benigno told reporters today that he believed the Cabinet revamp was complete and Mrs. Aquino did not plan to accept any other resignations.

Laurel and Arroyo had been at odds virtually since the start of the Aquino administration on Feb. 25, 1986. Mrs. Aquino was swept to power in a civilian- military uprising that ousted Marcos, who fled to Hawaii.

Mrs. Aquino said Arroyo agreed to leave the government Wednesday night, believing his departure ''would bring peace and quiet'' to her administration. Business, military and other groups accused Arroyo of incompetence.

Today, the president recalled Arroyo's struggle for human rights during the Marcos era, including his legal defense of her imprisoned husband, opposition leader Benigno Aquino, who was assassinated four years ago when he returned from exile in the United States.

''When integrity was unpopular and unsafe, Arroyo stood by my husband and by the cross of democracy,'' she said. ''Countless men and women owed their rescue from torture and unjust imprisonment to his brave and tireless efforts to give them what protection he could from the laws at that time.''

Mrs. Aquino, speaking on national television, called Arroyo ''a man of unwavering fidelity, of proven courage, patriotism and true nationalism.''

She said, ''I hope no one interprets his departure to mean that these ideals, which fired our struggle for democracy, have likewise departed as the ideals of the new nation and government we established. For I shall continue to hold fast to these ideals.''

In a letter to the president, dated Wednesday, Arroyo noted he had asked three times to be relieved as executive secretary.

''I irrevocably reiterate it this time,'' he said. ''Serving our country and your presidency was one of the most rewarding chapters in my life.''

Benigno, the president's spokesman, told reporters Mrs. Aquino and Sigur met for 45 minutes and talked about the coup attempt and ways to revive the economy, which received a sharp setback in the mutiny.

Sigur said the United States would speed up aid to the Philippines and do ''everything we possibly can'' to strengthen the government.

Benigno said Mrs. Aquino told Sigur she hoped to improve relations between the government and military. The spokesman quoted Mrs. Aquino as saying, ''I think I am the best example of how we can forget the past.'' Mrs. Aquino has blamed military officers for the assassination of her husband.

Although loyal troops crushed the latest mutiny, coup leader Col. Gregorio ''Gringo'' Honasan escaped with hundreds of armed followers. He remains in hiding and has vowed to continue his struggle against the Aquino government.

Honasan claimed Mrs. Aquino was doing too little to end the nation's 18- year-old Communist insurgency.