The U.N. Security Council voted yesterday to send a 4,000-man peace keeping force into southern Lebanon to monitor the withdrawal of Israeli troops and establish a ceasefire.

In speedily adopting an U.S.-drafted resolution calling for Israel to halt immediately its military actions in Lebanon and "withdraw forthwith," the Security Council responded to Lebanese Ambassador Ghassan Tueni's urgent appeal to end the killing on Lebanese soil that began Tuesday.

Israel's invasion of Lebanon was in retaliation for a Palestinian terrorist attack launched from that country on March 11, in which 40 persons died.

The U.N. vote came just before Israeli Prime Minister Menachem Begin arrived in New York for an overnight stay en route to Washington. At Kennedy Airport, Begin said he had been told of the U.N. resolution but for Israel the main problem was to prevent future terrorist attacks from being launched from southern Lebanon.

"We are going to discuss this in Washington as well," he said. Begin is to arrive in Washington today for a three-day visit, seeing President Carter on Tuesday.

Begin refused further comment on the U.N. action and Israeli officials here did not say directly that their forces would withdraw. On leaving Israel, Begin said, "We will clarify this issue when we are in Washington. All Israelis have a great many doubts about the solution of deploying a U.N. force."

A second Security Council vote was expected late last night implementing the plans - already prepared - that Secretary General Kurt Waldheim placed before it for getting the force into the field.

Waldheim's plan calls for first elements of an estimated five battalions and a 1,000-member logistics force to be in place within hours flown there aboard U.S. aircraft already approved by Washington.

The U.N. Interim Force in Lebanon is to carry arms "of a defensive character" and will be authorized to use force only in self-defense. Its first task, Waldheim said will be to monitor an Israeli withdrawal.

Underlying the Security Council's action was an apparent determination to take further steps if the fighting in Lebanon does not end and withdrawal start quickly.

The Council ignored an Israeli request t delay any U.N. action until after Begin's arrival.

"Israel's only desire seemed to be to delay and delay," one diplomat said. "It was not lost on us that Israel was occupying more territory each day we delayed."

Tueni began the meeting by requesting that the ambassadors forego their scheduled speeches and vote immediately. "I am doing this because human lives are engaged and operations on our terrain are taking a very bad course," Teuni said.

The diplomats agreed and the resolution for the peacekeeping force was approved 12-0, with the Soviet Union and Czechoslovakia abstaining and China declining to take part in the vote.

U.S. Ambassador Andrew Young hailed the vote as demonstrating politic restraint."It was a result that was asked for very simply and very powerfully" by Tueni, who declared "let my people live," Young said.

Advance elements of the U.N. force will be drawn from U.N. peacekeeping contingents on duty in the Sinai between Israel and Egyptian lines and between Israel and Syria on the Golan Heights. They will be Austrians, Finns and Swedes, a U.N. official said.

Any of the 15 members had the right to delay action by asking for 24 hours to consider the plan. Soviet Ambassador Oleg Troyanovsky told reporters, "We have no intention of delaying matters."

Tueni said he hoped the peacekeeping force would be in place as soon as possible.He said the Russian delegation was taking "a positive attitude."

Asked whether he was pleased by the Security Council resolutions, Tueni said he was happy to see swift movement, but added: "A resolution will not return life to the dead."

The United States began its diplomatic activity with the goal of coupling establishment of a peacekeeping force with a demand for Israel's withdrawal. "If the U.N. had simply called for an Israeli withdrawal we would have been in a tough spot," one souce said.

Washington wanted Israel to pull back, but opposed efforts by the Soviet Union and some Arab nations to demand a withdrawal that would have left southern Lebanon up for grabs by Palestinian, Lebanese Christian, Syrian and other armed forces. It was far from certain also that Israel would have obeyed such a demand.

In working to avoid a Soviet veto, U.S. officials started with Lebanon - the most directly involved Arab nation. Whether on procedural matters or on substance, Israel's enemies at the United Nations could not maintain anti-Israel positions at the expense of Lebanon.

Once Lebanon, which was desperate for quick international action to shore up its weak government and nearly powerless army, opted for a resolution coupling Israeli withdrawal to the introduction of a peacekeeping force, the opposition's teeth were drawn.

Tueni, Indian Ambassador Rikhi Jaipal Kuwait's Ambassador Abdalla Yaccoub Bishara and Ambassador Donald McHenry of the United States were the main participants in hammering out and gathering support for the American-drafted resolution.

Soviet Ambassador Troyanovsky said Moscow abstained because the resolution lacked several points that had been put forward by the Soviets in private negotiations. The Soviets wanted language condemning the Israeli invasion. They also wanted the peacekeeping force subject to removal any time Lebanon asks and a time limit on the force.

The second and third Soviet demands reflect long-standing Soviet efforts to shorten the rein on which the secretary general operates so the Security Council, in which the Soviets have a veto, would become even more decisive.

Waldheim recommended to the council that the force be established six months subject to renewal.