Police described the alleged attacker as a "terrorist", but gave no more details on his identity.
A police spokeswoman said he attacked an Israeli trooper who tried to search him and whose protective vest prevented the knife from causing injury.
The incident took place in a part of Jerusalem's Old City close to a site holy to both Muslims and Jews, where an increasing number of visits by Israelis has stirred Palestinian rancour that has contributed to the past two weeks' surge in violence.
(Writing by Dan Williams; Editing by Andrew Heavens)