JOHANNESBURG, South Africa (AP) _ Two police officers were sentenced Thursday to hang for the killing of two reputed drug dealers.

One of the officers, Sgt. Robert van der Merwe, had testified that he carried out the slayings because his co-defendant, Capt. Jack La Grange, told him the victims were helping the African National Congress, the main anti- apartheid guerrilla movement.

According to evidence presented during the three-week trial, La Grange was hired by alleged drug dealer Peter Pillay to arrange the killing of two men said to be his rivals, Bennie Ogle and Ernest Molokoane.

Van der Merwe testified that on Sept. 28, 1987, while he was with La Grange, he shot Ogle and Molokoane. Ogle died and Molokoane suffered five gunshot wounds but survived.

Van Der Merwe said that on Oct. 4 he killed Pillay, again at La Grange's instructions.

Supreme Court Justice Irving Steyn, who presided over the non-jury trial, said it was possible van der Merwe had been duped by La Grange into killing Ogle but ruled that the sergeant had no excuse for Pillay's slaying.

An execution date is pending. Steyn said the two police officers could appeal their murder convictions for the death of Ogle, but not for the killing of Pillay.

La Grange, 40, had claimed he was being framed by superiors, while van der Merwe, 30, contended that he thought he was taking part in an approved clandestine operation.

Van der Merwe told the court that he knew of previous ''clandestine operations'' in which security police carried out missions to kill suspected ANC operatives.

By law and custom, apartheid establishes a racially segregated society in which the 26 million blacks have no vote in national affairs. The 5 million whites control the economy and maintain separate districts, schools and health services.