Rambam's "The Laws Concerning King Moshiach" is a Fabrication. God calls Moshiach David, a Shepherd.
Also, his Messianic Era and world exaltation of the Jews are fabrications.
“Moses Maimonides (Moses ben Maimon; known in rabbinical literature as “Rambam”; from the acronym Rabbi Moses Ben Maimon; 1135–1204), rabbinic authority, codifier, philosopher, and royal physician. The most illustrious figure in Judaism in the post-talmudic era, regarded by many as the greatest Jewish philosopher of the Middle Ages, and one of the greatest of all time. He was successful in bringing four cultures (GrecoRoman, Arab, Jewish, and Western) together in one person, and in doing so, remains one of the most influential religious philosophers of the intellectual world.
His teaching influences other faiths as well as Jews, however, it is his commentary on Jewish texts that mark him out as one of the most influential and important Jews in history. He wrote three major essays on Jewish law, the most famous being ‘The Guide for the Perplexed’, and each of them is still regarded as hugely important in Jewish philosophy. This monumental work laid the foundation for all subsequent Jewish philosophic inquiry known as Chakirah, and stimulated centuries of philosophic Jewish writing. His large fourteen volumes work “Mishneh Torah” to date holds canonical authority in regard of a codification of Talmudic law.” From the Jewish Virtual Library, The Famous People and the BBC.
Rambam says in Chapter Twelve, paragraph 2 of ‘”The Laws Concerning King Moshiach”: “Our Sages taught: [Berachos 34b] “There will be no difference between the current age and the Era of Moshiach except [our emancipation from] subjugation to the [gentile] kingdoms. The simple meaning of the words of the prophets appears to imply that the war of Gog and Magog [Yechezkal ch. 38] will take place at the beginning of the Messianic age. Before the war of Gog and Magog, a prophet will arise to rectify Israel’s conduct and prepare their hearts [for the Redemption], as it is written:
[Malachi 3:23] “Behold, I am sending you Eliyahu  [before the advent of the great and awesome Day of G-d].” He will not come [in order] to declare the pure, impure, nor to declare the impure, pure;
nor [will he come in order] to disqualify the lineage of those presumed to be of flawless descent, nor to validate lineage which is presumed to be blemished. Rather, [he will come in order] to establish peace in the world; as [the above prophecy] continues [Malachi 3:24], “He will bring back the hearts of the fathers to the children.”
Elijah does not come to establish peace in the world but to make the many righteous by his knowledge in reconciling the sons to the fathers and fathers to the sons (the families) of the Jewish people by having them be mindful of the Teachings God gave Moses at Horeb and to the practice of Judaism; to be a messenger of the new covenant with sin forgiveness; and to clear the way for the Lord to return to His Temple.
Rambam and the Sages say in Chapter Twelve, paragraph 3 of “The Laws Concerning King Moshiach”: “During the Era of the King Moshiach, once his kingdom has been established and all of Israel has gathered around him, the entire [nation’s] line of descent will be established on the basis of his words, through the prophetic spirit which will rest upon him. As it is written [Loc. cit., v. 3], “He shall sit as a refiner and purifier. He will purify the lineage of the Levites first, stating that “This one is a priest of defined lineage” and “This one is a Levite of defined lineage.”
Rambam basis for this belief is a verse in the book of Ezra:
[Ezra 2:63] “The governor said to them, ‘[They shall not eat of the most holy things] until a priest arises [who will wear] the Urim and Tumim.’” From this verse, one can infer that the genealogy of those presumed to be of unquestioned [priestly and Levitical] lineage will be traced by means of the prophetic spirit, and those found to be of such lineage will be made known. He will define the lineage of the Israelites according to their tribe alone; i.e., he will make known each person’s tribal origin, stating that “This one is from this tribe” and “This one is from another tribe.”
“He shall sit as a refiner and purifier” from the first paragraph of Chapter Twelve, paragraph 3 is not Moshiach. God purifies and refines and He comes with Elijah and the angel of the covenant. Rambam says a prophetic spirit which will rest upon the anointed one.
The prophecy of the Hebrew Bible are the prophecies of God. David does not have a prophetic spirit. While prophetic spirits were a common belief in the ancient age and middle ages that is not true for the ages of reasoning and information. Isaiah 11/2 defines the attributes of the spirit that alights upon the anointed one as “A spirit of wisdom and insight, A spirit of counsel and valor, A spirit of devotion and reverence for the Lord”. That was for antiquity. know how to read the Bible. The Spirit of God in Isaiah 11 is a person, the Angel of God’s Presence the Holy Spirit