Was he acquitted before the events of Chamber of Secrets?
No, I believe not. Very few people besides Dumbledore knew that Tom Riddle and Voldemort were the same person, even after his rise to power. As Dumbledore explains to Harry at the end of the book:
“Hardly anyone connected Lord Voldemort with the clever, handsome boy who was once Head Boy here.”
— Chamber of Secrets, chapter 18 (Dobby’s Reward)
So very few people went over Riddle’s school days looking for the work of Voldemort-in-waiting, and even if you found something, it’d be quite a job to prove it.
Further, as Cornelius Fudge explains when he arrests Hagrid, the official record still points a finger for the original killing firmly at Hagrid:
“Look, Albus,” said Fudge, uncomfortably. “Hagrid’s record’s against him. Ministry’s got to do something — the school governors have been in touch —”
— Chamber of Secrets, chapter 14 (Cornelius Fudge)
If Hagrid had since been acquitted, there would be no justification for arresting him now. It follows that he’s still considered responsible for opening the Chamber in the 1942 school year.
And as Harry surmises, Hagrid as the guilty party nicely matches up with the course of events:
“We always knew Hagrid had been expelled,” said Harry miserably. “And the attacks must’ve stopped after Hagrid was kicked out. Otherwise, Riddle wouldn’t have got his award.”
— Chamber of Secrets, chapter 14 (Cornelius Fudge)
The case was open-and-shut. Nobody was looking for an alternative explanation, because the facts seemed to fit. (Prejudice against Hagrid for being half-giant probably counted against him as well.)
Was he acquitted after the events of Chamber of Secrets?
Yes, it seems so. The diary seems to act as sufficient proof that Ginny was not acting of her own free will in 1992, and could then be used to suggest that Tom Riddle framed Hagrid in his school years (recall that Dumbledore always suspected Tom, but all he lacked was proof):
“Well?” said Mr. Malfoy sharply. “Who is it?”
“The same person as last time, Lucius,” said Dumbledore. “But this time, Lord Voldemort was acting through somebody else. By means of this diary.”
— Chamber of Secrets, chapter 18 (Dobby’s Reward)
Since Ginny suffers no punishment, and Hagrid is released from Azkaban shortly afterwards, it seems that this proof was accepted by the Ministry.
Further recall that he only becomes a teacher in Prisoner of Azkaban, which fits with the idea that he’s been acquitted – the Ministry might have tolerated a convict as a Gamekeeper, but a teaching placement, less so – alongside this JK Rowling quote which sounds as if his punishment was lifted at the same time:
Since Hagrid's name was cleared in Book 2, will he ever be allowed to do magic openly again?
He is allowed. He has been allowed to do magic openly ever since he became a teacher but because he was never fully trained his magic is never going to be what it should be. He is always going to be a bit inept.
— Interview with JK Rowling, South West News Service, July 2000 (Accio Quote)