Dr. Feygin and members of the staff at his two clinics prescribed more than 3.7 million pills from 2012 to 2017, and received more than $16 million in reimbursements from Medicaid and Medicare, officials said; the third clinic was responsible for 2.6 million pills, and was reimbursed more than $8 million.

The investigation was conducted in part by the federal Drug Enforcement Administration, the New York City Investigation Department and special narcotics prosecutor’s office, the State Department of Health, and the Brooklyn district attorney’s office.

Mr. Brook-Krasny helped direct unnecessary laboratory testing of urine samples through his affiliation with Quality Laboratory Services in Sheepshead Bay, officials said. (His LinkedIn page describes him as the company’s chief operating officer.) He also arranged to alter test results with conditions like the presence of alcohol that would have made opioids difficult to prescribe.

Frank V. Carone, Mr. Brook-Krasny’s lawyer, said that his client would turn himself in when he returned from a family trip and that he was “simply a third-party service provider and nothing more.”

“My client understands the seriousness of the charges, and of course opioid abuse, but as for the allegations that he is somehow culpable is an incredible injustice,” Mr. Carone wrote in an email.

As he was led into a Manhattan courthouse at the head of a line of suspects, Dr. Feygin denied that he or his co-defendants had ever fed anyone’s addiction.