MOSCOW, NOV. 19 -- In an effort to quell speculation that Soviet leader Mikhail Gorbachev's position may be weakened by internal political wrangling, two senior officials today insisted that the recent dismissal of Moscow party chief Boris Yeltsin would not slow the pace of Gorbachev's reform drive.

Foreign Ministry spokesman Gennadi Gerasimov and Kremlin policy adviser Evgeny Primakov used public appearances to combat a widespread perception among western diplomats and other foreign analysts here that last week's firing of Yeltsin, a protege of Gorbachev and an outspoken advocate of his changes, was a political setback for the leader and his policies.

"You should not draw the conclusion that something is happening to perestroika," Gerasimov told a press conference, using the word for Gorbachev's campaign to restructure the economy. "Perestroika is going on."

The spokesman appeared to be responding to speculation here that Gorbachev made a decision to back Yeltsin's ouster as a compromise with Communist Party conservatives who have sought to moderate the pace of the reforms.

Gerasimov also sought to rebut speculation that Gorbachev may be approaching his meeting with President Reagan in a weakened or distracted state because of domestic political concerns. Contending the Yeltsin affair had no bearing on next month's three-day meeting in Washington, Gerasimov said, "This is purely an internal matter. There is no effect" on foreign affairs.

Yeltsin's meteoric career as the Communist Party chief in the capital and candidate member of the country's ruling Politburo fell abruptly after an Oct. 21 speech to the powerful Central Committee in which he reportedly castigated some party leaders for being too cautious on reforms.

He was ousted as the capital's party leader last week. On Wednesday, he was named as first deputy chairman of the State Construction Committee, with the rank of minister. While considered a serious demotion, the posting was seen as respectable for a politician who had fallen into disgrace.

Yeltsin, 56, is currently hospitalized in Moscow with a heart condition, officials have said. Gerasimov said the stay would be brief and warned against seeing any "evil conspiracy" in the sudden illness.

Primakov, the director of the Soviet World Economy Institute, spoke in a live television satellite discussion between members of the Supreme Soviet, or legislature, and the U.S. Congress. Asked whether Yeltsin's ouster meant the end of Gorbachev's drive for democratization, Primakov said that "Yeltsin was dismissed for failing to cope with his duties as first secretary of the Moscow Communist Party Committee."

"The fact that he got such a high appointment" on Wednesday, Primakov added, "should end speculation about this matter."

Gerasimov attributed Yeltsin's demise to excessive ambition. "The style of his leadership was criticized. Ambition exists in politicians -- Brutus killed Caesar because he was ambitious," he said. "Yeltsin didn't succeed. Things didn't work out. It happens."