Juliet Evancho, a transgender woman whose sister performed at President Trump’s inauguration, scored a temporary legal victory on Monday when a federal judge ruled that she and two other transgender students at a Pennsylvania high school must be given access to restrooms corresponding to their gender identity.

In his ruling, Judge Mark R. Hornak, of the United States District Court for the Western District of Pennsylvania, concluded that the three students had a “reasonable likelihood” of success in arguing that the Pine-Richland School District’s decision last fall to bar them from using those bathrooms was unconstitutional. As a result, he granted a preliminary injunction that they had sought against the policy.

“The ruling is a reminder to school districts across Pennsylvania and across America that they have a legal duty to respect the gender identity of all their students,” said Omar Gonzalez-Pagan, a lawyer with Lambda Legal, the nonprofit civil rights group that is representing the three students.

The decision came amid renewed national focus on transgender rights. On Wednesday, Mr. Trump rescinded rules allowing transgender students access to bathrooms in line with their gender identity, prompting a strong response from advocates. Among them was Ms. Evancho’s sister, Jackie, who had performed at the inauguration.