A few hours after the Senate voted to approve the Second Panama Canal treaty, one of President Carter's senior advisers was asked to assess the political impact of that vote on the still-smoldering presidential ambitions of Ronald Reagan.

"Nice thought," the Carter aide replied with a grin. "I hadn't time to reflect on that."

So began the inevitable political fallout from the treaty vote, in which the president had invested so much of his personal prestige.

In the White House, there was obvious elation over the outcome of the Panama debate and reported angerr on Carter's party at suggestions that most of the credit belonged to the Senate leadership.

Zbigniew Brzezinski, the White House national security affairs adviser, told reporters Tuesday night that he hoped the "appropriate conclusions" would be drawn from the president's handling of the canal issue.

"He takes on hard issues, he sticks with them and he prevails," Brzezinski said. "We're going to deal with other issues the same way."

For Carter, as in the first treaty vote, the most important aspect of the Senate's vote Tuesday was that he avoided a potentially debilitating defeat that would have deepened the troubles of his administration. And by winning on Panama, White House aides hopes for new momentum for other administration initiatives.

"When you win it helps you win in other areas, and when you lose it makes it more difficult," one presidential assistant said. "I hope this will help us in a lot of areas, including the SALT (strategic arms limitation talks) treaty when we have one."

Among Republicans, Sen. Barry M. Goldwater (R-Ariz.) predicted yesterday that Senate Minority Leader Howard H. Baker Jr. (R-Tenn.) had ruined his chances for the 1980 GOP presidential nomination by his support for the treaties.

Meanwhile, Reagan, the former California governor who made the proposed "giveaway" of the canal the main issue in his 1976 Republican primary campaign against then-president Ford, said the Senate vote was "a very extreme case of ignoring the sentiment of the people of or country. They were overwhelming in their disapproval."

A spokesman for Baker conceded that Baker's crucial role in support of the treaty will probably be a political minus among Republicans, but said that volved in any presidential campaign.

Both the White House and the State Department sought to minimize the importance of a statement Tuesday night by Panama's military leader, Gen. Omar Torrijos, that he was prepared to resort to violence against the canal had the Senate rejected the treaty.

White House press secretary Jody Powel said it "is safe to assume that the president was prepared to defend American interests and the canal," but thpared to defend American interests and the canal," but that Panama has accepted both of the treaties."