A federal appeals court on Wednesday threw out a lawsuit alleging that President Trump’s ownership of private companies that accept foreign-government business violates the U.S. Constitution.

Reversing a lower court, the Fourth U.S. Circuit Court of Appeals in Richmond, Va., ruled that the state of Maryland and the District of Columbia lacked standing to bring their claims against Mr. Trump.

“Word...