Martyn Coulter, 36, was found not guilty of six charges in Edinburgh High Court on Tuesday, one of which, that of assaulting the girl, was not proven.
The jury of nine men and six women took less than four hours to acquit him of the charges after they adjourned Monday afternoon.
Coulter had denied raping and assaulting a woman and a six-year-old boy.
During the seven-day trial, the court heard evidence about the alleged incidents.
But no specific dates were agreed on when the incidents were said to have occurred.
Coulter’s defense agent, Ian Duguid KC, presented evidence at trial showing Coulter’s whereabouts on September 23, 2013, including Google maps, timelines, bank statements, and social media posts.
The court was also shown records from Coulter’s army training records, which revealed that he was on a training course between 6 and 21 September of that year.
One woman told the court on February 6 that she could not remember the exact date, but said she went to Coulter’s apartment at lunchtime on or about September 23, 2013, to celebrate the news that she was going to to serve a tour of duty in Afghanistan with the Territorial Army.
She told the court that he had wanted to have sex with her to celebrate, but she told him she didn’t want to because she didn’t have the time. She alleged that she then raped her.
But the court heard that she appeared to have been out with Coulter that night.
He also told the court that he could not remember the night in question, as it was 10 years ago.
The witness, however, insisted that she did not remember having been with him on the date in question.
Mr Duguid told the witness that Coulter had not received a letter that he would be posted to Afghanistan in September, and had actually been told in November that he would be posted for a maximum of 12 weeks due to his being in the Territorial Army.
Coulter was suspended from Police Scotland as a result of the allegations.
Upon hearing the verdict, an emotional Coulter put his head in his hands and wept with relief.
Screams could also be heard from members of his family and friends who had gathered in the public gallery to support him during the trial.
Judge Lady Drummond told him: “Mr Coulter, you have been cleared of all charges and you may go.”
A Police Scotland spokeswoman said: “The officer remains suspended and as criminal proceedings have been concluded the matter will now be assessed for misconduct by Police Scotland’s Professional Standards Department.”