MOSCOW — THE new democratic order in the Soviet Union is moving rapidly to bring perhaps its most feared opponent to heel - the dreaded KGB secret police.In decrees issued the past few days, Soviet President Mikhail Gorbachev has sacked the entire senior leadership of the KGB, transferred control of hundreds of thousands of KGB troops, and set up a commission to investigate the agency and prepare proposals for its reorganization. The anti-KGB operation is a direct response to the prominent role played by its director, Vladimir Krychkov, in the leadership of the junta which attempted to seize power last week. As more details emerge of the coup plot, it is increasingly clear that the KGB was the center of the planning for the operation. Senior KGB officials were directly involved in leading the deployment of KGB units, including commando groups designated to storm the Russian parliament of Boris Yeltsin and teams sent out to arrest prominent democrats. Immediately after the failure of the coup and the arrest of its leaders, Mr. Gorbachev installed prominent liberal Vadim Bakatin as the new KGB chairman. He also transferred KGB military troops, which number several hundred thousand, including border forces and units for internal control, to the Defense Ministry. This includes two elite Army divisions which had been put under KGB authority last winter. The handling of the KGB has been distinctly harsher than that meted out to the Army, some of whose senior leaders and troops also participated in the coup. But the refusal of many of Army units and officers to join the coup was key to its failure. Gorbachev told the Soviet military daily Krasnaya Zvezda on Wednesday that "one of the major reasons for the coup failure is that those who usurped power failed to turn the Army against the people. The Army lived up to its expectations." Some KGB officers have insisted that they, too, resisted the coup. The commanders of the special "Alpha" anti-terror squad told the Tass news agency that they had refused to follow orders to storm the Russian parliament building late on the first night of the coup. "We believe that our refusal to obey the unlawful order has saved the country from civil war," they told Tass. The head of the Russian republic's KGB branch, Viktor Ivanenko, expressed similar views to Tass, insisting that Mr. Kryuchkov was isolated and had little support from the "overwhelming majority of KGB officers." Still, the judgment on the KGB seems to be that only a virtual dissolution and reorganization will suffice. On Aug. 28, Gorbachev dissolved the KGB Collegium, the senior leadership body of the organization. One member of that group, deputy KGB chief Col. Gen. Viktor Grushko, was also arrested and charged with treason. The following day, two more KGB deputy chiefs including the head of the personnel department, Lt. Gen. Vitaly Ponomarev, were sacked. At the same time, a commission of inquiry was created under the chairmanship of Sergei Stepashin, the head of Russian parliament's security committee. Before Oct. 26, the group is to draw up a report on the role of the KGB in the failed coup and formulate proposals to restructure the KGB and amend the appropriate legislation. Former KGB general Oleg Kalugin, who was a celebrated defector to the side of the democrats last year and is now a member of parliament, foresees a complete transformation of the agency. He told reporters that it should become "a regular police force concerned with the protection of the constitution, with counterintelligence activities, intelligence - and that's all. "No political functions, no troops, no secret laboratories where they manufacture poison and special weapons. Interception of communications will be taken from them, protection of the president will be taken from them. We shall make it a safe organization for a democratic society."