The Sorting Hat is a sentient magical artifact that has the ability to initiate communication and have conversations with the person wearing it. There's two things that make me wonder if it would have been possible for the Sorting Hat to have told Dumbledore which student was a Horcrux:
First, the nature of the Sorting Hat itself:
There's nothing hidden in your head,
The Sorting Hat can't see.
So try me on and I will tell you
Where you ought to be . . .
Sorcerer's Stone - Page 117 - US Hardcover
Second, we know Harry is definitely a Horcrux:
"You were the seventh Horcrux, Harry, the Horcrux he never meant to make."
Albus Dumbledore - Deathly Hallows - Page 709 - US Hardcover
If Dumbledore had put on the Sorting Hat and had a conversation with it about Harry Potter, would the hat have been able to tell Dumbledore that Harry was a Horcrux?