US lawyer Eric Lewis made the claim in a witness statement given at Mr Assange’s extradition hearing in London on Tuesday.
This comes as the 49-year-old Australian, who is currently being kept in Belmarsh Prison, is trying to fight extradition to the US, where he faces 18 charges following the leaks of classified documents in 2010 and 2011.
"WikiLeaks and Mr Assange pose a threat to the legitimacy of Trump's (election) campaign that he is desperate to squash by diverting attention and imprisoning Mr Assange,” the lawyer claimed.
Watch: Extradition hearing resumes for Wikieaks founder
"WikiLeaks is a vulnerability for Trump because of the evidentiary links between his campaign and WikiLeaks,” he added.
Trump praised WikiLeaks in 2016, the year that the organisation leaked Democratic National Committee emails to the “undoubted benefit of Trump”, according to Mr Lewis.
The Old Bailey heard that the president remarked during his campaign: “I love WikiLeaks.”
Three years later, Mr Trump said he knew nothing about WikiLeaks other than that it had “something” to do with Mr Assange, it was claimed.
In his statement, Mr Lewis also said: "The prosecution of Julian Assange is part of Trump's efforts to distract attention from the help that WikiLeaks gave to focus attention on the earlier leaks, which are much more politically potent for him.
"He wants to put Mr Assange in jail and keep him quiet."
The US prosecutor in the case challenged Mr Lewis over this claim, suggesting it was “just conjecture”.
The prosecution also contested Mr Lewis’ statement that the WikiLeaks founder could face 175 years in prison if found guilty in the US, describing it as a “soundbite” for the defence.
Mr Lewis countered that this sentence length was a reasonable “likelihood”.
The extradition hearing continues and will last for four weeks.