The judge Trevor N McFadden has in a decision stated that the White House's decision contradicts the constitutionally protected freedom of speech.
"According to the Constitution's first amendment, the government cannot open its doors to certain journalists ... and close these doors to other journalists based on their opinions", writes McFadden in his ruling.
The White House decided earlier this year to ban AP's journalists from the White House, Trump's residence Mar-a-Lago in Florida and the president's plane Air Force One because AP still calls the bay in the Atlantic the Mexican Gulf – despite Donald Trump having changed the name to American Gulf.
AP then sued three high-ranking officials within President Donald Trump's administration.
The government has one week to respond to the judge – who was appointed by Donald Trump in 2017.