The Reagan administration said yesterday that it has begun a national search for housing for the homeless on military installations and in other government buildings.

A Defense Department spokesman confirmed that Secretary Caspar W. Weinberger asked the military services on Jan. 25 "to locate vacant hospitable space" for the homeless.

Weinberger's memo told commanders "the most urgent need is in large cities where the weather is severe."

The Pentagon confirmation occurred after Col. Ernest Miller, a Salvation Army official, revealed the plan, which was reported last week by the Los Angeles Times. Miller, who had participated in months of negotiation between the White House and religious and charitable organizations, went public after he had been told that the Weinberger memo was classified, he said.

Miller said the White House meetings began to produce results after Thanksgiving when administration staff members "felt they had been burned" by media coverage of an aborted study to tax unemployment benefits.

The Department of Housing and Urban Development also confirmed yesterday that it would survey all vacant properties owned by the government for possible use by the homeless.

Other government agencies also are expected to look for suitable temporary quarters, Miller said.

But Miller said "a lot of technical details" remain to be worked out.

He said the Reagan administration expected volunteer groups and charitable agencies to handle details such as security and payment of utilities inside government facilities.

Miller also said the homeless would be expected to move out of the facilities when the need for government use arose. An example cited by Miller and the Defense Department involves barracks occupied occasionally--usually during the summer--by the National Guard.

The Defense Department spokesman said no count of available space had been turned in from the field yet.

He said the search probably would concentrate on military bases in operation, but that facilities closed in past economy moves would be potential candidates.

Other volunteer groups have asked the administration to allow the homeless to sleep in federal office buildings after they close at night. But that plan apparently was rejected because of security problems.

White House assistant press secretary Mort Allin said that the charitable organizations, primarily an ad hoc committee headed by Rabbi Martin Siegel of Columbia, Md., had petitioned the White House to ask "defense and other agencies" about the availability of emergency housing.

"It was felt they could be of some assistance," Allin said.

President Reagan also was asked at an informal news conference yesterday if the government was looking at plans to help the hungry and homeless.

"We certainly are doing everything we can in that regard," he responded.

Miller said it was his understanding that it would be necessary to establish "a clear community need" before the plan would go into effect.

He also said White House aides made it clear that the proposals would have to fit into the administration's general policy of "volunteerism," with private organizations handling most of the administration, such as token $1-a-year leases.