3 John 1:11

Beloved, follow not that which is evil, but that which is good. He that doeth good is of God: but he that doeth evil hath not seen God.

The instruction is not to imitate what is bad but to imitate what is good. Doing good is evidence of belonging to God, while doing evil is evidence of never having seen God.

In its original setting, the evil to be avoided was the conduct of Diotrephes, who loved to have the preeminence. He refused to receive the brethren who were preaching the gospel to the Gentiles, spoke malicious words against them, hindered their reception, forbade those who were willing to receive them, and cast those who did receive them out of the church. His contempt for unimpressive strangers grew out of a sense of self-superiority and a failure in courtesy. The good to be imitated was the conduct of Gaius, who faithfully showed kindness to brethren and to strangers. He received and entertained them and sent them forward on their journey in a manner worthy of God, and by doing so became a fellow helper to the truth, a character likewise seen in Demetrius, who had a good report from all men and from the truth itself. The verse therefore calls for God's missionaries always to be given a kind reception.