The federal government said it reached an agreement to drop charges against a Massachusetts state judge, who allegedly helped block an undocumented immigrant's arrest, in exchange for her referring herself to a panel that investigates judicial misconduct.