President Carter celebrated his 54th birthday yesterday with a trip to the Kennedy Space Center here and a pledge that the United States will not surrender its leadership role in space exploration.

Speaking to several thousand National Aeronautics and Space Administration employes and their families inside a huge building where the U.S. space shuttle vehicle will be assembled, Carter said that in the coming generation the U.S. space program "will reflect the range of our requirements and interests as a vigorous, responsible and free society."

"Those activities will be measured against all the needs of our country," he added. "We will be encouraging other countries to participate both in the work and in its benefits. But we will not give up the leadership of the United States in space."

In the course of the speech, the president also sought to reasssure the public about U.S. ability to verify compliance with arms accords, which is expected to be a key element in the debate over a new strategic arms limitation agreement with the Soviet Union.

"Photoreconnaissance satellites have become an important stablizing factor in world affairs," he said. "In the monitoring of arms control agreements, they make an immense contribution to the security of all nations. We shall continues to develop them."

White House officials said Carter's speech marked the first time that an American president had publicly acknowledged U.S. use of "spy satellites" to monitor other nation's compliance with international arms agreements.

The use of such satellites has been known for years and the president's decision to acknowledge that fact publicly appeared to be aimed primarily at domestic worries over verification in a second Strategic Arms Limitation Talks (SALT) treaty.

"It is important for people to know that we are in a position to verify without relying on the good intentions of the other party," press secretary Jody Powell told reporters should Air Force One enroute here.

The United States and the Soviet Union appear close to agreement on SALT II, with a summit conference signing ceremony possible later this year and a bruising Senate debate over ratification likely next year. The emphasis White House officials placed on Carter's brief mention of spy satellites was clearly the beginning of an administration public relations campaign to sway public opinion in favor of Senate approval.

The president, accompanied by his wife, Rosalynn, and daughter, Amy, flew to the Kennedy Space Center to commemorate the 20th anniversary of NASA and to present the first congressional space medals to five veterans of the U.S. space program and the widow of an astronaut who died here while preparing for a space fight.

The medals were presented to former astronauts Neil A. Armstrong, Frank Borman, Charles Conrad Jr., Alan Shepard Jr. and John H. Glenn Jr., now a Democratic senator from Ohio. A posthumous award was presented to astronaut Virgil (Gus) Grisson, killed in a 1967 spacecraft fire, and was accepted by his widow, Betty.

Before his speech, Carter spent 10 minutes inspecting the space center's Launch Pad A, from which all but one of the Apollo spacecraft were launched for the moon and where the first fight of the U.S. space shuttle vehicle is to begin next September.

In the space center's eight-acre Vehicle Assembly Building, standing in front of a towering simulator of the space shuttle, the president extolled the accomplishments of the space program but warned that it is "too early to commit the nation" to such exotic and expensive projects as space "factories" and solar-power satellites.

The Carter administration has not emphasized the space program. With the president's overriding concern with inflation, it is not likely that NASA's budget will grow significantly in the years ahead.

Calling the effort to land a man on the moon a "stupendous achievement . . . that captured the imagination of the world," Carter said the space program has changed man's perspective about his world.