Another way of saying it:
The Ass and His Purchaser
(You might prefer to call this The Donkey and His Purchaser.)
A man wished to purchase an Ass (a Donkey), and decided to give the animal a test before buying him. He took the Ass home and put him in the field with his other Asses.
The new Ass strayed from the others to join the one that was the laziest and the biggest eater of them all.
Seeing this, the man led him back to his owner. When the owner asked how he could have tested the Ass in such a short time, the man answered, "I didn't even need to see how he worked. I knew he would be just like the one he chose to be his friend."
Comment: Grown ups might want to make the useful distinction that while a person is apt to be judged by the company he (or she) keeps, that doesn't mean you have to choose to be like the company you keep.
Notable: A much more life and death fable with a similar message is contained in The Farmer and the Stork, the moral of which is, "Birds of a Feather Flock Together."
How to use Aesop's Fables.
More stories with morals.
Storytelling to improve behavior.