A Portland man has pleaded guilty to assaulting a federal officer outside an immigration office in South Portland.