U.S. District Court Judge Frederick B. Lacey, a Republican former prosecutor from New Jersey, withdrew yesterday as the Carter administration's choice to deputy attorney general.

In a letter to outgoing Attorney General Griffin B. Bell, Lacey said he had agree to take the job on the condition he would be "on board" by September 4, a deadline now precluded by the mouth-long congressional recess that begins this weekend.

Bell said he regretted Lacey's decision because his experience as a prosecutor, judge and member of the new national wiretap court "equips him a singular way for the position." Lacey said he had set the deadline because he felt constrained from sitting on criminal cases or performing wiretap court duties while President Carter considered making the appointment.

Though Lacey never was nominated, news that he was the first choice triggered criticism from several quarters.

Alan Dershowitz, a Harvard Law School professor, mounted a campaign to stop the nomination, claiming that Lacey was unfit because he was too close to the prosecutors in criminal cases. Lacey was U.S. attorney in New Jersey in the early 1970s and defense attorneys there have charged privately that after he became a judge he had private meetings with proecutors during trials in his court.

There was no sign yesterday that the criticism was taken seriously by the Justice Department, but there was some speculation that it might have been a factor in Lacey's decision because it forecast a drawn-out confirmation process.

Incoming Attorney General Benjamin R. Civiletti said he had "three or four" persons in mind as possible alternatives to succeed him as deputy.

Bell is known to have been impressed with Lacey because of his handling of an espionage case involving two Soviet employes of the United Nations last year.