BOSTON — Pharmacy benefits manager Optum Rx has agreed to pay $5.8 million after allegedly failing to follow workers’ compensation prescription pricing procedures, according to the state Attorney General’s Office.

These procedures are in place to keep down costs and prevent overcharges in the workers’ compensation insurance system.

The settlement, filed in Suffolk Superior Court, resolves allegations that Optum Rx, in some circumstances, failed to apply various regulatory benchmarks, such as the federal upper limit for Medicare and the Massachusetts Maximum Allowable Cost, to its pricing determinations for certain workers’ compensation insurance prescription drug charges.

These failures, according to the settlement, allegedly occurred on various injured-worker prescriptions filled in Springfield, New Bedford, Boston and Worcester at Walgreens, CVS and RiteAid locations.