Police described the attack, which happened at around 10.40am, as unprovoked.
It is alleged the suspect came up to the officer patrolling the Södermalm district and stabbed him with a sharp object. The officer received minor injuries and was able to leave hospital in the afternoon.
An investigation into attempted murder is under way and a 17-year-old teenager was seized immediately after the incident by the victim's colleague who took up the chase.
The attack happened near the Björns Trädgård subway exit, across the road from the busy square Medborgarplatsen.
It is not uncommon to see police in the area, but there has been an increased police presence recently after a demonstration against deportations to Afghanistan was relocated there from another part of central Stockholm. A police officer at the scene told The Local that the protesters were not involved.
Swedish media report that the suspect is a man previously known to police in the Björns Trädgård area. No other details have been disclosed.