The Israeli Army transferred more than 1,000 Lebanese prisoners to a detention facility inside Israel today in preparation for the closing of its Ansar prison camp in southern Lebanon on Wednesday.

The Army also announced that several hundred other prisoners who remained in Ansar will be released on Wednesday as a gesture of good will toward the residents of southern Lebanon.

Military officials here conceded that Israel has a "legal problem" in transferring the prisoners to its own territory. The Fourth Geneva Convention prohibits the transfer of civilians to the territory of an occupying power.

The Lebanese prisoners whom Israel has held in the Ansar camp are not members of a regular military organization and therefore not technically prisoners of war but civilian detainees.

The Army said the prisoners were being "temporarily transferred to a detention facility in Israel, due to the absence of a better immediate solution in Lebanon that will ensure their security and proper internment conditions."

It added that "Israeli law guarantees the rights and privileges relating to the handling of the detainees and their rights in accordance with the conditions appearing in the Fourth Geneva Convention."

The plan to dismantle the Ansar prison camp, which Israel established shortly after its June 1982 invasion of Lebanon, indicated that the Israelis are nearing the second stage in their planned three-stage withdrawal from Lebanon.

An Israeli military communique said the prisoners who will be released are members of "various terrorist organizations" but had not attacked Israeli forces in southern Lebanon. It said that the prisoners who will remain in Israeli custody, to be released later, "took an active part in terrorist activities against Israel" and that to release them now "could endanger Israeli forces and Lebanese citizens."

The Army announcement did not give exact numbers of the prisoners involved, but military officials said the Ansar camp contained about 1,600, almost all of them Lebanese Shiite Moslems detained in connection with Israel's attempts to halt the guerrilla attacks on its forces in Lebanon. The officials said more than 1,000 of the prisoners were transferred to Israel today.

Meanwhile, the military command here announced that one Israeli soldier was killed and three wounded in two separate incidents in southern Lebanon. The casualties raised the Israeli toll to 24 killed and 49 wounded since Israel began its three-stage withdrawal from Lebanon on Feb. 16. At least 640 Israeli soldiers have been killed since the June 1982 invasion.

The Lebanese prisoners who were transferred to Israel today traveled in a heavily guarded convoy of buses with covered windows. The prisoners were blindfolded and their hands were tied behind their backs, according to reports on Israel radio.

In a radio interview, Lt. Gen. Moshe Levy, the Israeli Army chief of staff, said release of the prisoners would depend on security developments in southern Lebanon.

The Ansar prison camp is located west of the Lebanese city of Nabatiyeh.

At its peak, the camp held more than 10,000 prisoners, most of them Palestinian guerrillas captured by Israeli forces in the early days of fighting in southern Lebanon in 1982. Most of the Palestinian prisoners were released in 1983 in exchange for a handful of Israeli prisoners of war.