In the book, Thresh doesn't know that Katniss and Rue teamed up until
Katniss tells him at the point of a spear, after Thresh had already killed Clove. He probably would have killed Kat outright too, except he'd heard something Clove said about Kat and Rue being allied, and gave Kat a chance to explain.
This point in the movies was trimmed; it's plausible that
Thresh heard enough of Clove's monologue to Katniss after their struggle to know that Katniss had teamed with Rue and tried to protect her.
Also, since in the movies we don't see hovercraft retrieving the bodies of fallen tributes, we may also believe
that Thresh came across Rue's body, decorated with flowers, and deduced that of the remaining tributes in the Games by that point, Katniss was the most likely to do that for a fellow tribute. Think about it: it would likely have been a girl and not a Career who would first want to befriend Rue and then to give her a funeral of sorts, which narrows it quickly to Foxface and Katniss, and Foxface hadn't been seen by anyone for more than a couple of seconds at a time since the bloodbath. Also, Thresh would have known that Katniss stepped in to take the place of her younger sister, and Rue was about the same age as Prim, making it even more likely that if anyone besides Thresh cared that Rue had died, it was Kat.