BANGOR, Maine — A Dexter man pleaded guilty Tuesday in U.S. District Court to being an accessory after the fact to manufacturing 1,000 or more marijuana plants at a large marijuana farm in Township 37 in Washington County.

By pleading guilty, Robert “Bobby” Berg, 50, admitted that he knew about the pot plantation and that police had raided it on Sept. 22, 2009, forcing workers to flee. The next day, a longtime friend asked Berg to pick up the undocumented workers in the woods in Washington County, according to the prosecution version of events to which he pleaded guilty.

“[Berg] took the workers to his residence and hid them in his barn,” the document said. “He provided them with food and clothing as well. A day or two after picking up the workers and giving them refuge in his barn, another offender came to the defendant’s barn and picked up the workers.”

Court documents do not identify the longtime friend who called Berg, but do state that he has been charged in connection with the Township 37 operation. The prosecution version of events said that Berg was aware of the marijuana farm but not involved in its operation.

In exchange for his guilty plea, federal prosecutors will drop three counts of harboring illegal aliens, according to the plea agreement filed last month.

“Mr. Berg’s plea agreement does not implicate him in the marijuana charge in which he had no involvement,” Berg’s attorney, Richard Berne of Portland, said last month in an email. “Nor did he benefit from it in any way. Finally, by agreeing to plead guilty, Mr. Berg is prepared to accept responsibility for his conduct, which is consistent with his character and otherwise unblemished record.”

Berg also waived his right to appeal his case to the 1st U.S. Circuit Court of Appeals in Boston if his sentence is longer than one year and a day. Sentences that long or longer allow inmates to earn good time in the U.S. Bureau of Prisons system.

A sentencing date has not been set. He remains free on $250,000 secured bail.

Berg was scheduled to be tried beginning Wednesday with three others in federal court in Bangor.

The plea agreement does not require Berg to testify against his co-defendants.

The marijuana farm, which was in operation between Jan. 1, 2006, and Sept. 22, 2009, has been described by police as one of the state’s most sophisticated outdoor marijuana operations, where some 3,000 plants, valued at approximately $9 million, were being cultivated.

The jury trial of Malcolm French, 52, of Enfield, Kendall Chase, 57, of Bradford and Rodney Russell, 50, of South Thomaston on multiple charges related to the operation of the marijuana farm is to begin Wednesday in federal court in Bangor.

A fourth man, Moises Soto, 53, of Nuevo Leon, N.M., who was also was charged in connection with the operation, pleaded guilty July 30 to being part of a drug conspiracy and harboring an illegal alien.

He is expected to testify at the trial.

Had Berg gone to trial and been convicted, he faced up to 15 years in prison and a fine of up to $5 million on the charge to which he pleaded guilty.