President Reagan reacted to the Mideast hostage crisis yesterday by canceling a 10-day vacation, the first time he has called off a scheduled trip to his California ranch during his presidency.

White House spokesman Larry Speakes said Reagan had "reviewed the current situation regarding the TWA hijack victims" in Beirut and then told White House chief of staff Donald T. Regan that he was canceling the trip, which was scheduled to begin Friday and last through July 7.

"The president just thinks it's best for him to remain here in the White Hosue while those people are being held over there, rather than go to the ranch for the Fourth of July," Speakes said.

The decision was a cogent illustration of the impact of the hostage crisis on the Reagan presidency. Reagan, who has spent 181 days at the ranch since his 1980 election, made a decision last week not to be pinned down in the White House because of the hijacking, contrasting it with President Jimmy Carter's decision during the Iranian hostage crisis.

However, several White House officials, including communications director Patrick J. Buchanan and adviser Edward J. Rollins, contended that it would be politically unwise to vacation while 40 Americans are held hostage, informed sources said.

One official said it would be "a definite negative" if television contrasted pictures of the hijacked airliner with shots of Reagan enjoying himself at his ranch. But another official emphasized policy considerations more than public relations, saying that "the president finds the present situation a difficult and delicate one and wants to be in the White House to deal with it."

Speakes said that Reagan reached his decision before receiving a staff recommendation. One source said that Nancy Reagan, often influential in scheduling matters, strongly favored canceling the vacation.

Asked if the president was "going to be viewed as being taken hostage, too," because of his decision, Speakes reiterated that Reagan would continue with his regular schedule except for the vacation, including a Chicago trip Friday to discuss tax reform.

Throughout his presidency, Reagan has highly valued trips to his mountaintop ranch northwest of Santa Barbara. In an April 15 interview with People magazine, then-deputy chief of staff Michael K. Deaver recalled that during a difficult period early in the Reagan presidency he had advised against going to the ranch.

"Look, Mike, you can tell me to do a lot of things, but you're not going to tell me when to go to the ranch," Deaver quoted Reagan as replying. "I'm 70 years old and I figure that ranch is going to add some years onto my life and I'm going to enjoy it."

Reagan was at the ranch on Sept. 1, 1983, when a South Korean airliner with 269 passengers aboard was downed by a Soviet fighter. The president's advisers urged that he return to Washington quickly, but Reagan stayed another day.

At the time Speakes denied that Reagan's return was part of a public relations effort and also said that while he is at the ranch the president "has every facility, every capacity, every capability to do, perform any function that he could perform in Washington."

Reagan cut short his vacation by three days on this occasion, the only time he returned from the ranch ahead of schedule. He came back from Augusta, Ga., a few hours early on Oct. 23, 1983, after a suicide bomber killed 241 U.S. servicemen in Beirut and returned three hours early from Camp David on June 16, two days after the hijacking of TWA Flight 847.

Pennsylvania Gov. Richard L. Thornburgh, one of a group of governors who met yesterday with Reagan at the White House, said the hostage situation appears to be "foremost on his mind" at this time.

Another member of the group, Virginia Gov. Charles S. Robb, responded uncertainly to a question about whether Reagan could push through his tax overhaul plan at this time.

"I don't think it's fair to say that the White House is immobilized," Robb said. " . . . But I think it's clear that until that situation in Beirut is resolved, there will be much less intensity in terms of interest in things other than the hostage situation."