The obvious answer is Gryffindor. After all, to quote the Hat's song in GoF
'Twas Gryffindor who found the way,
He whipped me off his head
The founders put some brains in me,
So I could choose instead!
Clearly, the Sorting hat was originally owned by Godric Gryffindor. However, is that really enough to make it a “relic” of Gryffindor? We’re never given an exact definition in the book, so I’m forced to supply my own: a relic is an item at one time owned by one of the founders, and given notable, unusual powers by that founder. After all, the locket was once owned by Merope Gaunt – but no one would consider calling it a “relic of Merope.”
The hat does not specify which founder or founders “put some brains in” it. I very much doubt, however, that it was Gryffindor alone. For one thing, each of the founders seems to have had certain areas of expertise, skills that might show up in their houses. After all, the expressed purpose of the Sorting Hat is to divide the students into groups based on which founder would have had the most interest in teaching them.
Today, the two specialties that seem to show up the most in Gryffindor house are Transfiguration – both Dumbledore and McGonnagal were transfiguration teachers, and many of the animagi we know of were in Gryffindor – and Defense Against the Dark Arts – Harry, obviously, has a knack for it, and Lupin, a Gryffindor alumnus, was one of the best DADA professors in the books. From what we’ve seen of the hat, transfiguration and DADA have little to do with the actual functioning of sorting process. Of course, there must be some pretty strong stuff on it to prevent other people from messing with how it functions, but I don’t really see Godric Gryffindor doing most of the spellwork on the Hat.
So who did? Well, first we must look at the areas of magical strength that seem to be common in the other houses. Slytherin is consistently linked with the Dark Arts, but I believe that potions can also be considered a Slytherin strength. Just as we have two generations of Gryffindor transfiguration professors, Slughorn and Snape represent two generations of Slytherin potions masters. I doubt there was much in the way of Dark Arts that went into the Hat, although potions might have played a major part in the process. Again – Salazar Slytherin probably put some work into the hat, but he was by no means the primary spell crafter in the creation of the hat.
The other two houses are harder to classify in terms of specialties; as Hufflepuff and Ravenclaw do not figure as prominently in the books, we know less about the typical huffie or ‘claw. Looking at the Heads of houses and the defining virtues, however, gives us something of a clue. Flitwick, the charms teacher, is head of Ravenclaw, and the defining virtue is intelligence. Sprout, the herbology teacher, is head of Hufflepuff, and the defining virtue has been identified as either work ethic or loyalty. It’s not hard to conjecture that Rowena Ravenclaw’s strengths may have been more toward the academic side of things (charms, arithmancy, astrology, etc.) while Helga Hufflepuff might have preferred the more hands-on branches of magic, perhaps focusing on such subjects such as herbology and care of magical creatures.
So, looking at the magical strengths the founders are likely to have had, what can we determine about the creation of the hat? Gryffindor had the idea; that much is stated. Ravenclaw, with her bent for theoretical, academic – and, perhaps, experimental? – magic would probably have done much of the work in defining what the Hat did and how it did such things. Also, (and I may be biased, as I believe myself to be a ‘claw at heart), I don’t think Gryffindor would have worked out the complexities of how best to sort the students. The Hat, after all, does not sort people based on the traits they currently exhibit, but the traits the have the most potential for. Ravenclaw would have been able to work out how to get the Hat to be able to do that. And, while she may have been the one doing much of the work on how the Hat functioned, I do not doubt that Gryffindor and Slytherin pitched in quite often, and Hufflepuff occasionally. I do not think that Hufflepuff played a major role – or at least not as major as Gryffindor or Slytherin – because having a reliable way of singling out the “best” students would not have been as important to her. To quote the Sorting Hat’s song in OoTP,
Said Hufflepuff, “I’ll teach the lot,
And treat them just the same.”
However, (and I have nothing from canon to back this up, merely my own views) it seems to me as if Hufflepuff might have been glad of something to keep down the stress between the other three – if anyone saw the Gryffindor/Slytherin rift coming, it would have been Hufflepuff.
What does this tell us about which founder the Hat is a relic of? Now, the first glance might say Ravenclaw. She is, after all, likely to have done much of the work on the Hat, and she is the only founder without a relic that is openly declared in canon. However, it wasn’t only her project. It was for the benefit for all of the founders, and all of them probably put at least a little work into it. Even Hufflepuff would have put some work in, recognizing it as being in the best interests of the school as a whole. The Hat, is, therefore a relic of all four founders. As such, and as a sentient being that can remember the founders themselves, who can say what use it might be to Harry in book 7?