A Northeast Washington man who was accused of training teen-agers to rob banks abruptly pleaded quilty to two bank robbery charges yesterday after it was learned that he approached key witnesses against him as they arrived at U.S. District Court and told them not to "snitch" on him.

The defendant, Avery Barber, 25, who had been free on personal bond, came to the federal court about an hour before his trial was to begin yesterday and was said to have spoken to the witnesses in the corridors and on an elevator.

Law enforcement officers said Barber told the witnesses to go home and offered to pay them the $30 fee they would normally get from the government for their court appearances.

Sources said that one of the witnesses, a teen-ager, left the courthouse after he had talked to Barber. Another youth, who the government said has been recruited by Barber to rob banks, unexpectedly appeared in the U. S. attorney's office yesterday morning and said he no longer wanted to testify at Barber's trial.After questioning, the 14-year-old, who was described as visibly upset, told prosecutors that Barber had talked to him yesterday morning in the courthouse.

Two female witnesses, described by sources as "overwrought," also appeared in the prosecutor's office and told authorities that Barber had approached them yesterday morning.

All four witnesses had various roles in three bank robberies that occurred last fall. Their testimony was described by law enforcement sources as "crucial" to the government's case against Barber.

After a brief hearing on the matter, senior Judge George L. Hart Jr., who was to preside at Barber's trial yesterday, immeidately revoked Barber's bond and ordered him into the courthouse lockup. As the jury was being assembled to proceed with the trial, sources said Barber suddenly agreed to accept the government's longstnding offer that he plead guilty to one count of bank robbery and a second charge of attempted robbery of a bank. In exchange for Barber's guilty pleas, the government is expected to dismiss other robbery charges against Barber.

Barber faces a maximum of 23 years in prison and $5,500 in fines on the two guilty pleas. Hart has not scheduled a date for sentencing.

The government plans later this month to ask a federal magistrate to revoke Barber's probation on a 1978 bank larceny conviction for which he had been given a suspended six-year sentence. That jail time could be added to any sentence that Hart imposes in the current bank robbery case.

Meanwhile yesterday afternoon, the federal prosecutor's office went to a federal grand jury here to begin presenting evidence against Barber for obstruction of justice in connection with the allegations that he attempted to coax the witnesses not to testify against him.

D. C. police arrested Barber, a vending truck driver, last October. Law enforcement officials said Barber allegedly trained juveniles, from age 14 to 16, in various holdup techniques, gave them notes to give bank tellers and drove them to targeted banks.

The youths, all of whom were unarmed, got a cut of the holdup proceeds, in one case as much as $135, authorities said.