Muhammad Musa Khan appeared in court in Lahore for a second time on charges of planning a murder, threatening police and interfering in state affairs.
But the judge said the case should never have come to court.
Police chiefs earlier said they had ordered action against an investigating officer.
Despite his young age, Muhammad Musa Khan was one of more than 30 people charged of attempting to kill police officers during a confrontation over electricity and gas supplies in the city of Lahore.
Pakistan media broadcast images of the infant in his first court appearance, sitting on his father’s lap and clasping a bottle of milk.
His grandfather asked journalists covering the case: “He doesn’t even know how to pick up his milk bottle properly. How can he stone the police?”
But Musa was much calmer in Saturday’s court appearance compared to his first, when he cried as his fingerprints were taken, says the BBC‘s Mike Wooldridge in Lahore.
Little Musa Khan has become something of a celebrity well beyond Pakistan’s borders for his appearance in a Lahore court, adds our correspondent.
The case against the rest of Musa’s family is still proceeding.