The video released by IS's affiliated Amaq news agency, subtitled in Arabic, shows teenager "Mohammed Riyadh" -- knife in hand -- announcing in Pashto he would carry out an "operation" in Germany, and presenting himself as a "soldier of the caliphate".
Amaq had earlier said the assailant who seriously wounded four tourists from Hong Kong wielding an axe and a knife on Monday "was one of the fighters of the Islamic State".
In the video that lasts two minutes 20 seconds, the 17-year-old says "soldiers of the caliphate" will attack "infidels" everywhere.
On Monday at 1915 GMT he seriously injured the four passengers on a local train between the town of Treuchtlingen and Wuerzburg in Bavaria, southern Germany.
The rampage appeared to be the first time the jihadist IS has claimed an attack in Germany.
Authorities in Germany said they had found a hand-painted IS flag among the belongings of the asylum-seeker, who was killed by police as he tried to flee after the attack.