The United States and the Soviet Union have engaged in some unpublicized tough talk during the past month over growing indications that Pakistan's nuclear program has moved far along the path toward production of an atomic bomb, according to administration sources.

The discussion was generated by a direct and unusually tough Soviet warning to Pakistan about its nuclear activities, the sources said, including a charge that the Pakistanis are on the verge of constructing a nuclear bomb, which Moscow indicated it would not tolerate.

The Reagan administration, on learning of the warning, responded with a private message to Moscow reiterating the strong U.S. commitment to Pakistan's security. One official described the message as extremely grave and said that Washington, in effect, told Moscow to keep "hands off" Pakistan.

A well-placed intelligence source said that Central Intelligence Agency analysis shows that Pakistan has or soon will have the capacity to build a bomb, despite official denials by Pakistan. Sources said longstanding Pakistani nuclear efforts have increased this year. According to one account, it is just a matter of assembling components.

The security of Pakistan as well as its highly secretive nuclear program are likely to be discussed during the visit of Pakistani Prime Minister Mohammad Khan Junejo, who is to arrive late today on his first official visit to Washington. Details on Page A13 .

Junejo, whose civilian government was installed last Dec. 30 after nearly nine years of military rule, is to meet President Reagan Wednesday morning and see other senior administration figures as well as members of Congress before departing Friday.

Pakistan is particularly sensitive for both superpowers because of its geography bordering Afghanistan and because nearly all of the U.S. covert assistance to the Afghanistan resistance fighting the Soviet army flows through Pakistan, with Pakistani permission.

The Soviets have issued a number of stern warnings to Pakistan to stop that flow in the past several years, and Soviet warplanes based in Afghanistan have repeatedly crossed the border into Pakistani airspace, bringing protests from Washington as well as Islamabad.

The immediate impetus for the recent Soviet warning to Pakistan is believed by Washington officials to have been the visit to Moscow in mid-June by Indian Foreign Minister P. Shiv Shankar, who reportedly complained vociferously about Pakistan's nuclear efforts.

Moscow's warning, which was delivered by the Soviet ambassador in the Pakistani capital of Islamabad, also covered the Afghanistan issues. It was considered particularly important, though, because of the nuclear aspect, which had not been a matter of urgency in other recent Moscow-Islamabad exchanges.

Pakistan's well-advanced nuclear program, which goes back well over a decade, is a touchy issue in Washington.

The Carter administration strongly condemned Pakistan's secret efforts to build an atomic bomb and cut off U.S. aid to Pakistan because of them.

The Reagan administration, which began a $3.2 billion Pakistan aid program in 1981, has been required by Congress to certify annually that Pakistan does not "possess" an atomic bomb. A stronger assurance may be required to persuade Congress to approve a new $4 billion U.S. aid program negotiated with Pakistan this March.

White House national security affairs adviser John M. Poindexter is concerned, according to sources, that the administration may not be able to certify to Congress as required in October that Pakistan does not "possess" a weapon. High-level meetings have reportedly been held in recent days to assess the Pakistani nuclear program in light of the most recent U.S. intelligence.

"There is no question that Pakistan has the bomb or will soon," a congressional source said.

Leonard S. Spector, an expert on nuclear nonproliferation issues at the Carnegie Endowment for International Peace, reported in November that Pakistan is "at the threshold of becoming a nuclear-weapons state." Spector said yesterday that more recent information, which he said he could not describe in detail, suggests that "something very serious has happened" in the Pakistani nuclear program since last winter.

In March the Foreign Report of The Economist of London cited reports that Pakistan had succeeded in enriching uranium to 30 percent at its heavily guarded atomic plant at Kahuta. While this would be well short of the 90 percent level needed to make a bomb, such an achievement would far exceed the 5 percent level reportedly cited in a confidential letter from Reagan to Pakistani President Mohammed Zia ul-Haq in September 1984 as the highest enrichment level acceptable to the United States.