Yad Rama (Sanhedrin 93b): “The Messiah-as it is written (Yeshaya 11:2), And the spirit of the Lord shall rest upon him, the spirit of wisdom and understanding, the spirit of counsel and might, the spirit of knowledge of the fear of the Lord. And shall make him of quick understanding [wa-hariho] in the fear of the Lord. … Rava said that means that Moshiach will have the ability to smell a man and determine whether he is guilty or innocent.” That means that Moshiach will understand through ruach hakodesh the truth of the matter. He will not judge based on the claims of the litigants nor will he judge based on witnesses but will simply know through ruach hakodesh who is innocent and who is guilty… The gemora states, “Bar Kosiba (Bar Kochva) ruled for two years and then told the Rabbis that he was Moshiach. The Rabbis replied to him that it is foretold that Moshiach will judge guilt or innocence by means of smell – therefore they asked him to judge a case purely on the basis of smell to demonstrate that he was truly Moshiach. When the Rabbis saw that he was not able to judge by smell alone they killed him.” This can be explained by saying that Bar Kochva was liable to capital punishment because he was a false prophet since he claimed to be Moshiach who has ruach hakodesh which enables him to judge by smell. Thus falsely claiming to have ruach hakodesh makes a person a false prophet.