In an unprecedented move, the new director of the National Science Foundation sought the resignations of the heads of three of the agency's scientific branches this week after the White House pressured him to put its appointees in the jobs.

Director Edward A. Knapp acknowledged that the White House had made the request, but said he would have chosen new people anyway to form his own management team.

The action has surprised leading scientists because the science agencies traditionally have been protected from the political house- cleaning that takes place when a new administration comes into office.

The NSF, with a billion-dollar annual budget, is the main source of funds for basic, non-medical scientific research in the United States.

A month ago Knapp said he would not be "headhunting" at the NSF, but this week he asked for -- and received -- the resignations of Donald Langenberg, deputy director of the agency and its assistant director for the biological, behavioral and social sciences; Frank Johnson, assistant director for astronomical, atmospheric, earth and ocean sciences; and Eloise Clark, assistant director for behavioral and social sciences.

Johnson had planned to resign anyway, but the other two apparently had not. All the other NSF assistant directorships that are presidentially appointed positions are already vacant.

"I am very disappointed," said William McElroy, former NSF director and until recently chancellor of the University of California at San Diego. "There is no reason for this kind of thing below the level of deputy director [of the whole agency]."

"Our government has to depend on professional people. If the people are incompetent, okay. But there is no way of saying someone like Eloise Clark is incompetent. She is a first-rate scientist and everyone knows it."

"It comes as a surprise to all of us," said Lewis M. Branscomb, chairman of the National Science Board, which oversees NSF policy. "I hope this will not be regarded as a precedent-setting event."

Knapp said yesterday that top officials in both the White House Personnel Office and the White House's Office of Science and Technology Policy spoke to him about seeking the resignations of agency officials.

Asked whose idea it was, Knapp replied, "Of course, the presidential personnel office wants to have its appointees in every presidential slot in the United States. There is no question about that . . . . Of course it's their idea.

But he added, "I was not forced to any decision by any of the parties. I made the decision that the correct thing to do was to get the search started, . . . to make a team for me while I am the manager.

Knapp said had he considered the tradition of keeping on agency officials from one administration to the next, but decided that was outweighed by his desire to have his own team.

He said another consideration was his desire to go along with the White House, which, he said, "was going forward with us for an enhanced budget in a time of very difficult stress, [and] where they want me to be successful" in selling the fiscal 1984 budget, reflecting new Reagan administration priorities, to Congress.

McElroy, who was NSF director under President Nixon, said that selling a budget to Congress is no reason to dismiss personnel below the level of deputy director, since they have no direct role in budget presentations.

Knapp acknowledged yesterday that the swift manner in which he forced the resignations was a mistake. "I was too abrupt . . . . I am not by nature a person who does things like this easily," he said, reflecting on his initiation into Washington political life.

"I didn't come to the agency to politicize it. I came to manage it, and the agency needs management," he said.

Knapp is a friend and former colleague of George Keyworth, the president's science adviser.