Q:

Why didn't the ministry know when Tom Riddle made the first horcrux?

Voldemort made his first horcrux while he was still attending Hogwarts. Shouldn't the trace alert the ministry about a magic that powerful? They caught Harry using a patronus charm within hours, surely they would have noticed Tom using magic to create a horcrux (and maybe the killing curse).

A:

Because he was still at Hogwarts and concealed his tracks carefully.
Here’s what we know:

Per his own confession, he was sixteen when he made the diary, which means that the Trace was still in effect:

“I decided to leave behind a diary, preserving my sixteen-year-old self in its pages, so that one day, with luck, I would be able to lead another in my footsteps, and finish Salazar Slytherin’s noble work.”
— Chamber of Secrets, chapter 17 (The Heir of Slytherin)

Some time in his sixth year, he began investigating horcruxes. This makes him about sixteen or thereabouts, per Dumbledore’s explanation to Harry:

“At the same age as you you are now, give or take a few months, Tom Riddle was doing all he could to find out how to make himself immortal.”
— Half-Blood Prince, chapter 23 (Horcruxes)

Riddle’s birthday falls at the end of the calendar year. Per a memory from Caractacus Burke, describing an encounter with Merope shortly before Riddle’s birth:

“Yes, we acquired it in curious circumstances. It was brought in by a young witch just before Christmas, oh, many years ago now. She said she needed the gold badly, well, that much was obvious. Covered in rags and pretty far along… going to have a baby, see.”
— Half-Blood Prince, chapter 13 (The Secret Riddle)

The associated murders are believed to be the murder of the Riddles, during the summer between his fifth and sixth years, which were pinned on Morfin Gaunt. As Dumbledore explains, the Ministry would know about the magic, but not that he was responsible:

“But how come the Ministry didn’t realise that Voldemort had done all that to Morfin?” Harry asked angrily. “He was under age at the time, wasn’t he? I thought they could detect under-age magic!”
“You are quite right – they can detect magic, but not the perpetrator: you will remember that you were blamed by the Ministry for the Hover Charm that was, in fact, cast by –”
— Half-Blood Prince, chapter 17 (A Sluggish Memory)

Given a clear-cut confession from Gaunt (by Riddle’s hand), they didn’t investigate further.

As such, we can deduce that he made the horcrux between September and December of his sixth year of school. We know the Trace either ignores magic in Hogwarts. That includes dark magic, or Moody’s Unforgivable Curses in a classroom full of students would be picked up as well. As such, if he was carefully to make the horcrux while still at school, he’d be able to do so in secret.

