The self-styled “yellow vest” protester James Goddard has denied calling the MP Anna Soubry a Nazi and a traitor, during a chaotic court hearing in which the judge adjourning proceedings partway through.

Goddard, 29, pleaded not guilty to harassing the politician in Westminster between 18 December 2018 and 8 January 2019. He also denied one count of racially aggravated behaviour likely to cause harassment, alarm or distress, relating to a police officer, and another count of behaviour likely to cause harassment, alarm or distress, when he appeared at Westminster magistrates court on Tuesday.

Goddard repeatedly gesticulated to the packed and noisy public gallery during the hearing. He is expected to rely on a defence of “fair comment”.

Addressing the judge, Kenneth Grant, from the dock, Goddard said: “It’s not illegal to heckle an MP. All of this is wrong.”

Grant rose and temporarily adjourned the case 15 minutes into the hearing after several people in the public gallery began shouting about Brexit. They made derogatory comments about Soubry and chanted: “Shame on you.”

The hearing resumed briefly and the judge informed Goddard of his bail conditions, but it descended into chaos again soon after Goddard left the dock complaining to the judge that he could not get a fair trial.

He will return for a two-day trial on 19 July, during which Soubry is expected to be among the witnesses. It is not known whether or not the Independent Group MP will give evidence in person.

Goddard, from Timperley in Altrincham, Greater Manchester, allegedly shouted and chanted at Soubry, pursued her, filmed her, called her “scum”, “Nazi” and “traitor”, and used other insulting language.

Goddard livestreamed his arrival at court online and addressed supporters outside on the hearing’s conclusion.