The ruling is the latest legal setback to President Trump’s sweeping effort to compel changes to state election standards.