An independent inquiry by senior Irish lawyer James Hamilton had been examining whether the first minister misled the Scottish Parliament over what she knew and when.
His report said Ms Sturgeon, who appointed him personally, had given an “incomplete narrative of events” to MSPs.
But he said this was a “genuine failure of recollection” and not deliberate.
Mr Hamilton, pictured right, said he was therefore of the opinion that Ms Sturgeon had not breached any of the provisions of the code.
The code sets out the standards expected of Scottish government ministers, and states that anyone who deliberately misleads Holyrood would be expected to resign.
Mr Hamilton concluded in his report that Ms Sturgeon did not breach the ministerial code in respect of any of the four issues he considered.
These included allegations that Ms Sturgeon had failed to record a series of meetings and telephone discussions with Mr Salmond and others in 2018.
Mr Hamilton concluded that the meetings were government business – contrary to Ms Sturgeon’s claims that they were a party matter – but accepted her reasoning that “it would have been impossible to record such meetings or discussions without a risk of prejudicing the proceedings or interfering with their confidentiality”.
He also looked at whether the first minister “may have attempted to influence the conduct of the investigation” into the harassment complaints made against Mr Salmond, her predecessor as first minister and SNP leader.
The lawyer said the key point was that Ms Sturgeon had not intervened, and said that had Mr Salmond really believed she had agreed to it during a meeting on 2 April 2018 then, “one might have expected him to follow it up and to press home his advantage” – but that no further contact was made for three weeks.
The third issue centred on whether Ms Sturgeon misled the Scottish Parliament in relation to the meetings in 2018.
The first minister insisted she had first learned of the complaints from Mr Salmond at her home on 2 April, but later said she had had “forgotten” about a meeting with his former chief of staff four days earlier, on 29 March.
Mr Hamilton said it was “regrettable” that Ms Sturgeon had not told MSPs about this meeting, but that he found it “difficult to think of any convincing reason” for her to deliberately conceal it.
He said she had given parliament “an incomplete narrative of events”, but added: “I accept that this omission was the result of a genuine failure of recollection and was not deliberate.”
The fourth ground of investigation alleged that Ms Sturgeon was in breach of her duty to comply with the law in relation to Mr Salmond’s successful legal challenge against the Scottish government.
Mr Salmond has pointed to external legal advice warning that the government may be at risk of losing the case as early as October 2018, but ministers decided to fight on until January 2019 – and ultimately had to pay Mr Salmond more than £500,000 in legal costs.
Mr Hamilton said Ms Sturgeon had relied on advice from the law officers, as she was “fully entitled” to do, and said Mr Salmond “appears to be under the misapprehension that the government is under a duty to withdraw a case if advised that there is less than an evens chance of winning”.
The lawyer’s 61-page report concluded: “I am of the opinion that the first minister did not breach the provisions of the ministerial code in respect of any of these matters.”
Ms Sturgeon welcomed the findings, and said she had “sought at every stage in this issue to act with integrity and in the public interest”.
She added: “As I have previously made clear, I did not consider that I had broken the code, but these findings are official, definitive and independent adjudication of that.”
The Scottish Conservatives plan to hold a vote of no confidence in the first minister on Tuesday afternoon – but it looks doomed to fail after the Scottish Greens said they would not support it.
A separate report by a cross-party committee of MSPs that has been examining the government’s botched handling of the complaints against Mr Salmond is expected to be published on Tuesday morning.
Meanwhile, in response to publication of the James Hamilton report, the leader of the Scottish Liberal Democrats Willie Rennie said:
“The judgement from James Hamilton does not make the First Minister’s resignation automatic but no-one can deny that her errors of judgement still make resignation a live consideration.
“James Hamilton does not give the First Minister a clean bill of health. He says it is up to parliament to determine whether it has been misled over the help that the First Minister is said to have offered Alex Salmond in her home.
“Even the most ardent SNP supporter must recognise that the women involved were let down by the government and that half a million pounds was wasted defending the indefensible in court.
“These matters will be addressed by the committee report tomorrow which will need to be considered carefully.
“Let me be clear. No-one will win from this ugly episode, certainly not Alex Salmond who has been exposed for what he really is.”
Mr Salmond was cleared of 13 charges of sexual assault against nine women after a separate High Court trial in March of last year.
It comes just six weeks before the Scottish Parliament elections on 6 May