Naa’imur Zakariyah Rahman, 20, believed he was days away from inflicting “lethal violence” with a blade and explosion before his arrest last November, a prosecutor told the Old Bailey.
Rahmen allegedly spoke about his plan in messages sent to an undercover MI5 agent who was posing as an IS official in Syria.
Prosecutor Mark Heywood QC said the accused was inspired by an uncle who had joined IS in Syria before being killed in a drone strike.
Mr Heywood read the jury a Telegram chat in which Rahman thought he was was speaking to an IS official.
On 14 September last year, Rahman is alleged to have said: “Can you put me in a sleeper cell ASAP?”
“I want to do a suicide bomb on Parliament. I want to attempt to kill Theresa May.”
The next day, he said: “My objective is to take out my target. Nothing less than the death of the leaders of Parliament.”
The court heard how Rahman had praised the Manchester arena bomber, Salman Ramadan Abedi, saying he “did well”.
He allegedly said he thought about wearing “a vest”, driving past Parliament and “pushing the button” to “clear the entire block… Everyone inside, including the Prime Minister would be dead”.
Mr Heywood told jurors: “His settled conclusion was that lethal violence here, directed at the very heart of the United Kingdom government, was the only effective way to pursue his intentions.”
Jurors heard that Rahman later told an MI5 agent he would aim to strike when Mrs May came out of 10 Downing Street to talk to the press.
About three weeks later, after making more claims, the court heard Rahman carried out reconnaissance around Whitehall, walking past the entrance to Downing Street.
Rahman is also accused of helping his friend Mohammad Aqib Imran, 22, join IS in Syria by recording a sponsorship video.
Mr Heywood said the men knew each other well and shared the same “warped ideology”.
The prosecuting barrister said: “He [Imran] elected to travel and set about assembling money, acquiring a fake passport, engaging in research and otherwise equipping himself with the information and means to travel aboard for violence for terrorist purposes.”
Rahman, from Finchley, north London, has denied two counts of preparing terrorist acts.
Imran, of Sparkbrook, Birmingham, has pleaded not guilty to preparing terrorist acts and possessing a terrorist document on his Kindle entitled How To Survive In The West – A Mujahid’s Guide 2015.
The trial continues.