US President Donald Trump has alleged that CNN and MSNBC refused to cover Chinese President Xi Jinping’s visit to the White House because they did not want to give him credit for the event.

In a post on Truth Social, Trump claimed that the two outlets deliberately avoided covering the arrival of Xi Jinping and his wife, Peng Liyuan, despite what he described as a major event.

“CNN and MSDNC’s Ratings have dropped considerably. The primary reason is NO CREDIBILITY! They only write badly about a man who won the Election IN A GIANT LANDSLIDE, winning all 7 Swing States, the Popular Vote, and 86% of the Counties, etc., and whose Popularity has grown because of the unprecedented SUCCESS our Country is having on both the World Stage, and at home,” Trump said.

He further accused the outlets of deliberately avoiding coverage of Xi’s arrival, saying they did so because they did not want Trump to receive credit.

“CNN and MSDNC, to show you how fake they are, refused to cover one of the Biggest and Most Beautiful Events to take place in many years, the arrival at the White House of the Highly Respected President of China, Xi Jinping, and his beautiful wife, Madam Peng. The event was magnificent — Actually made for Television but, because they’re Fake News, and because they knew how good it would be, they didn’t want credit to be given to ‘TRUMP,’ they refused to be there,” he said.

Trump added that the State Dinner being hosted at the White House for Xi would be a major event, with media organisations in attendance.

The comments came amid an ongoing dispute between the Trump administration and media organisations over access to the White House.

A US federal judge has directed the Trump administration to restore access to journalists from CNN, MS NOW and Politico to White House grounds, ruling that the ban was likely unconstitutional.

US District Judge Timothy Kelly, a Trump appointee, issued the order in a lawsuit filed by the three media organisations challenging Trump’s decision to bar them from the White House.

“The ‘general rule’ is that ‘individuals must receive notice and an opportunity to be heard before the Government deprives them’ of a constitutionally protected interest,” the judge said.

Trump had announced the ban in a Truth Social post, accusing the outlets of publishing what he called “fake news”. He said the restrictions applied immediately and named CNN, MS NOW and Politico.

“I am proud to announce that, effective immediately, I am banning Fake News CNN, MSNOW (who recently changed their name from MSNBC due to lack of viewership and credibility!), and Politico … from the White House as a result of their constant ‘reporting’ FAKE NEWS!” Trump said.

The three media organisations subsequently filed a lawsuit against the Trump administration, arguing that they were pursuing legal action to “defend the principle that the government does not decide what the press reports”.