First: one may answer that any sacred law revealed before ours is only relied upon when it does not conflict with our own, in keeping with the well-known maxim among the scholars of legal theory: “The law of those before us applies so long as our law has not come with something contrary.” Our law has indeed come with a contrary ruling—namely, that we do not entrust authority to anyone who seeks it.
Second: it may be said that Joseph, upon him be peace, saw that the wealth was being squandered and mishandled, and he wished to rescue the country from that misconduct. A request made for the purpose of correcting mismanagement and wrongdoing is therefore unobjectionable. For example, if we see a governor in some region who has failed in his duty and corrupted the people, a person suited to leadership—finding no one else capable—may ask the ruler to appoint him over that area, saying, “Entrust this town to me so that I may repel the evil that is occurring there.” Such a request is permissible and in harmony with the principles.
This brings to mind the hadith of ʿUthmān ibn Abī al-ʿĀṣ, who said to the Prophet ﷺ, “Make me the leader of my people,” meaning in prayer, and the Prophet replied, “You are their leader.”
Accordingly, the ruler must examine why a man has asked to be made a governor, a judge, or an imam, and then take whatever action he deems to be in the best interest of the community.