With bitter denunciations of President Carter and Ronald Reagan, Soviet President Leonid Brezhnev tonight pledged continued military backing for Babrak Karmal's embattled Marxist government in Afghanistan.

Brezhnev, claiming the Moslem insurrection against the Marxists and an estimated 85,000 Soviet troops is a matter "of the security interests of both our states," had no new suggestion for ending the intervention or the rebellion. Instead, he made clear the Kremlin believes time is on its side in gaining control for the Babrak government.

He declared there is a "sordid campaign" of military preparations and anti-Soviet paragraph headed by the highest ranking representatives of the Washington administration [and] figures of the two main parties. . . . They talk with amazing cynicism about unleashing nuclear war as if it were something normal, almost desirable, and are injuring people to accept this criminal idea."

Brezhnev did not mention Carter or Reagan by name, but the thrust of his remarks left no doubt about whom he was speaking. "They are slandering although they know well that neither Afghanistan nor the Soviet Union have any designs against third countries." He reiterated the Soviet position that it intervened in response to its 1978 friendship treaty with Kabul.

The Soviets leader asserted that both time and history are on his side. "The revolutionary process in Afghanistan is irreversible," he said in reaffirmation of the ideological perspective of the leadership. The official Tass news agency put the point this way: "Time,' Leonid Brezhnev said, 'works for new revolutionary Afghanistan.'"

Tass said the day's talks between the Afghans and the Soviets, which were followed by a state banquet, passed in "friendship and mutual understanding," meaning no disagreement. But it hinted as strong Kremlin awareness -- and pressure -- for Babrak to end the factional strife within the two wings of the ruling People's Democratic Party of Afghanistan. The talks included discussions of "broadening the party's base," a tacit admission of Moslem hatred for the Kabul Marxists.

The two sides signed a joint "declaration," which likely ensures continued military and economic aid to Afghanistan. Although Babrak last May proposed settlement talks with neighboring Iran and Pakistan, Brezhnev tonight omitted any reference to Iran, saying the Babrak proposal's "important element is to reach agreement with your neighbor, Pakistan."

The omission of Iran reflects in part the setback to Moscow's hopes of better relations with Tehran caused by the war against the Persians by Soviet ally Iraq.

Babrak, making his first trip outside Kabul since he was installed there last December by Soviet arms, was accorded the highest state honors today.