The Prime Minister described the demonstrators demanding action on climate change as "uncooperative crusties" who were holding up the traffic.
Mr Johnson was speaking at the launch in London of the third volume of Margaret Thatcher's biography by the former editor of The Daily Telegraph, Charles Moore.
He said the former prime minister had taken the issue of greenhouse gases seriously long before Greta Thunberg was born.
"I am afraid that the security people didn't want me to come along tonight because they said the road was full of uncooperative crusties and protesters all kinds littering the road," he said.He added: "The best thing possible for the education of the denizens of the heaving hemp-smelling bivouacs that now litter Trafalgar Square and Hyde Park would be for them to stop blocking the traffic and buy a copy of Charles's magnificent book so that they can learn about a true feminist, green and revolutionary who changed the world for the better."
However despite police warnings and the risk of arrest, many protesters had no plans to move their tents to Trafalgar Square.
One activist in his twenties told PA: "They came round and told us that we should be moving on. I don't think we are going to move on. It's not a risk if you know you're going to be arrested. It's something I'll do if I need to.
"We've got extremely good legal support and it's a very well set-up organisation so I feel like I'll be supported all through the way. An arrest doesn't mean a conviction."
Another young activist added that there was no pressure from the movement to protest in a particular way.
"Just because you're being arrested doesn't mean you do or don't support Extinction Rebellion any more than the next person," she said.
"There are people within this group that support this group very much and they won't be getting arrested, but they support everybody."