Alessandra Vella, the judge overseeing the case, said Carola Rackete was carrying out her duty to protect human life when she defied authorities and brought 41 African citizens to shore.
The judge lifted the house arrest which Ms Rackete had been placed under after Saturday’s incident.
The 31-year-old captain, who is a volunteer with German charity Sea Watch, was stranded in international waters for over two weeks, during a standoff with Italy.
The country has closed its ports to private rescue vessels but on Saturday Ms Rackete defied authorities and docked her vessel.
She rammed a police boat on her way to port and has said the collision was an accident.
Despite this Ms Rackete was arrested when she disembarked.
She faced up to 10 years in prison for endangering the lives of the four police officers on board but the judge ruled that she had not committed any act of violence.
The 31-year-old could still face separate charges of aiding illegal immigration.
The ruling is a blow to Italy’s anti-immigration government and its hard-right interior minister, Matteo Salvini.
“I am indignant, I am disgusted, but I will not give up,” he said, after the ruling was handed down on Tuesday.
“We will restore honour, pride, well-being, hope and dignity to Italy, whatever it costs.”
The incident has led to increased tension in Italy’s diplomatic relations with France and Germany.
Germany had earlier requested the captain’s release and a French government spokesperson condemned Mr Salvini’s behaviour on Tuesday.
“Mr Matteo Salvini’s behaviour has not been acceptable as far as I am concerned,” Sibeth Ndiaye told France’s BFM-TV.
“We are not relieved, we are angry,” Ms Rackete said when the boat first docked in Italy.
“This disembarkation should have taken place more than two weeks ago and it should have been coordinated instead of hindered by the authorities.
“European governments in their air conditioned offices have gambled with these people’s lives for more than 16 days. Not a single European institution was willing to assume responsibility, until I was forced to do so myself.”
An online fundraising campaign to help her, launched by two German TV stars, has so far raised almost a million euros (£896,000), while a separate fundraiser launched on Facebook by an Italian group has raised 435,000 euros (£389,000) in seven days.
More about: Italy