Senate Republicans yesterday chose Finance Committee Chairman Robert J. Dole (R-Kan.) over four rivals as Senate majority leader in a top-to-bottom leadership shuffle that strengthened the hand of moderates in the chamber and pointed to greater Senate independence from the White House.

The outcome of the hard-fought majority leader's race set off a chain reaction that resulted in a shakeup of the Senate's committee hierarchy.

Sen. Bob Packwood (R-Ore.) will succeed Dole as chairman of the Finance Committee, and Sen. Richard G. Lugar (R-Ind.) will take over Senate Foreign Relations. Sen. Jesse Helms (R-N.C.), who is the ranking member of Foreign Relations and could have been its chairman, will remain as chairman of the Agriculture Committee.

When the 99th Congress convenes on Jan. 3, Dole, 61, a skilled, independent and hard-charging lawmaker with presidential ambitions for 1988, will succeed retiring Sen. Howard H. Baker Jr. (R-Tenn.), another possible presidential contender.

The Republican senators who will serve in the 99th Congress elected Dole, 28 to 25, over Sen. Ted Stevens (R-Alaska), the current deputy leader, or whip, after first Sen. James A. McClure (R-Idaho), then Sen. Pete V. Domenici (R-N.M.) and finally Lugar were eliminated on close votes.

Chosen to serve with Dole were Sens. Alan K. Simpson (R-Wyo.) as deputy leader, John H. Chafee (R-R.I.) as head of the party's conference (official caucus), Thad Cochran (R-Miss.) as conference secretary, William L. Armstrong (R-Colo.) as chairman of the Senate GOP's legislative policy committee and John Heinz (R-Pa.) as head of its senatorial campaign committee.

The resolution of the leadership battles also determined the likely committee lineup for next year. Packwood will inherit perhaps the second most powerful post in the Senate.

Lugar got the chairmanship of Foreign Relations after Helms confirmed during yesterday's caucus that he will remain at agriculture despite pressure from his national supporters to take the foreign relations post. The current chairman, Sen. Charles H. Percy (R-Ill.), was defeated for reelection.

Packwood will be succeeded as chairman of the Commerce Committee by Sen. John C. Danforth (R-Mo.). Also, Sen. Barry Goldwater (R-Ariz.) is in line to take over the Armed Services Committee chairmanship from retiring Sen. John G. Tower (R-Tex.), although that shift was not affected by yesterday's elections.

The new leadership is perhaps even more centrist than the Baker regime, although it spans the philosophical spectrum of the party from Chafee, a member of the "Gang of Six" who are often to the left of the administration on tax and spending policy, to the conservative Armstrong.

In addition, Packwood has a record of outspoken criticism of the Reagan administration, even though he generally has gone along with it on tax policy.

Dole has a record of strong support for Reagan administration policies but has not hesitated to criticize them and has pushed aggressively for stronger efforts to reduce deficits, including tax increases that the administration was reluctant to accept. Dole said yesterday that he shares Reagan's reluctance to raise taxes except as a "last resort." But he emphasized that deficit reduction should have top priority next year.

Dole's demonstrated independence in dealings with the White House -- and his combativeness in dealings with the Senate Democrats -- was reported to be a major factor in overcoming many senators' queasiness about the possible impact of his presidential ambitions on his stewardship of the Senate.

"Given political realities, the president is a lame duck and the majority leader must move into that vacuum," said Sen. John W. Warner (R-Va.), who seconded Dole's nomination. "By picking the strongest candidate , we did indeed choose independence," he added. Several others said Dole was perceived as the most willing and capable of protecting Senate interests if they collide with those of the White House, as they did with some frequency in Reagan's first term.

But the White House, which stayed neutral in the Senate fight, was quick to extend a friendly hand to Dole. Presidential spokesman Larry Speakes said Reagan would telephone Dole to extend his "warm and hearty congratulations" and would meet with him soon.

After his election Dole said he will move both to carry out the president's program and to ensure continued control GOP of the Senate after 1986, when Democrats are expected to make a strong bid to reclaim the chamber.

But Dole slightly hedged his pledge of support for the administration. Senate Republicans, he said, "will support the president's program when we can."

The majority leader's powers within the Senate include setting its agenda through scheduling legislation, although Baker, despite his widely respected skills, was often frustrated by members who exploited Senate rules to pursue their own agendas. Many senators said they expect Dole to be firmer in cracking down on such activities, and Dole indicated yesterday that he intends to do so.

While Dole's election did not carry heavy ideological overtones, other developments appeared to solidify the strength of pragmatic group in the party and give an entree to its more liberal forces.

In particular, Chafee's election to the third-ranking leadership post, coupled with the surprisingly weak showing by McClure, the most conservative candidate for majority leader, amounted to a setback for conservative forces in the Senate.

McClure was washed out on the first ballot, despite expectations that his conservative backers would keep him in contention until the end or close to it. Chafee defeated the more conservative Sen. Jake Garn (R-Utah) by the same vote as Dole's, 28 to 25.

Also, Heinz defeated the more conservative Sen. Malcolm Wallop (R-Wyo.) by one vote for the campaign-committee job, although other factors may have played a part in that outcome, including Heinz's campaign fund-raising connections and his previous stint as chairman of the committee when the GOP captured control of the Senate in 1980.

The election of Dole also poses problems for conservative "Young Turks" in the Republican minority in the House, who are rebelling against the traditional leadership of more pragmatic party elders like Dole. He has been one of their primary targets. One of their leaders, Rep. Newt Gingrich (R-Ga.), dubbed Dole the "tax collector for the welfare state."

The conservatives' major victory was in electing Simpson as party whip over Sens. Slade Gorton (R-Wash.) and Robert W. Kasten Jr. (R-Wis.), although Simpson's popularity crosses ideological lines. Kasten, also a conservative, lost out in the first round. Then Simpson defeated Gorton, 31 to 22.

Together Dole and Simpson present a witty, sharp-tongued and articulate pair who are expected to enliven the sometimes torpid nature of Senate deliberations. Also Dole is expected to move to quicken the often snail-like pace of Senate business and to be a tougher leader than the consensus-minded Baker was in pushing it along.

"I do believe we spend a lot of time doing very little, and that may be an understatement," Dole said yesterday, hinting he may resort to long hours, if necessary, to force action.

But he also indicated he will take a deliberate approach toward rules changes aimed at expediting Senate procedures and made it clear he will include Democrats in formulating any changes.

He also indicated he will continue to play a major role in the making of tax policy, saying he will keep his Finance Committee membership and continue to participate in committee deliberations.

The secret-ballot votes for majority leader were cast behind closed doors of the tiny, historic Old Senate Chamber.

Voters included two GOP senators elected this month, Phil Gramm (Tex.) and Mitch McConnell (Ky.), but not the two who are retiring, Baker and Tower, or the two who were defeated, Percy and Sen. Roger W. Jepsen (Iowa).

Although the "Gang of Six" did not follow through on hints that it would try to determine the majority leader race by voting as a bloc, most if not all of them supported Dole and Stevens, thereby influencing the final choice, according to Sen. Robert T. Stafford (R-Vt.), one of the six. The group helped elect one of their own, Chafee, to a top leadership post.