Pakistani Prime Minister Mohammed Khan Junejo denied yesterday that his country is developing nuclear weapons after he was officially warned at the White House that such action would end U.S. economic and military assistance.

Junejo, in a meeting with the Senate Foreign Relations Committee, said that "whatever nuclear work is going forward is for civil purposes and to meet the needs of a developing country," according to Sen. Charles McC. Mathias Jr. (R-Md.), the ranking committee member at the meeting.

Another lawmaker said Junejo maintained that Pakistan is "abiding by the guidelines" established with the United States for its nuclear program and specifically that it is "keeping components separate."

Junejo appeared to be referring to guidelines contained in a September 1984 letter from President Reagan to Pakistani President Mohammed Zia ul-Haq asking Pakistan not to enrich uranium at its heavily guarded, secret enrichment plant to a level greater than 5 percent (the maximum needed for civil uses). Earlier U.S. messages to Pakistan reportedly included a warning not to assemble components in a way that would create a bomb.

In White House discussions, Reagan "underscored the continuing serious U.S. concern with unsafeguarded nuclear activities in Pakistan" such as the Kahuta enrichment plant, according to a senior administration official who briefed reporters afterward. Pakistan has refused to open its massive plant to International Atomic Energy Agency inspection or safeguards.

Pakistani officials "understand that building a nuclear explosive device would have enormous implications for their relationship with the United States," reporters were told.

It was "made clear" to the Pakistanis that economic and military assistance will be terminated if Pakistan acquires a nuclear weapon, the U.S. official said.

The touchy nuclear issue, long a major problem, has been made more urgent by recent U.S. intelligence reports that Pakistan has or soon will have the capability to build a nuclear bomb. The Reagan administration, in order to provide aid to Pakistan, is required to certify to Congress annually that "Pakistan does not possess a nuclear explosive device."

Reagan's ceremonial welcome on the White House South Lawn did not address the nuclear issue but described Pakistan as "one of our country's closest partners" and Junejo as "the elected prime minister of a constitutional government."

Junejo, 53, became Pakistan's first civilian leader in nine years last December upon the lifting of military rule by President Zia, who continues to be army chief of staff and to retain power of uncertain dimensions.

Reagan emphasized Pakistan's position on the "front line" against "the brutal Soviet occupation of Afghanistan" next door. During the private White House meeting, according to the briefer, Reagan reaffirmed "our long-term security commitment to Pakistan, relating that to the continuing Soviet pressures through Afghanistan."

Junejo made no mention of Afghanistan in his public response, but said he was honored to arrive "as the elected representative of my people."