According to the Rambam that you need a Melech for a milchemes mitzvah, how does the Rambam understand all the milchamos in the book of Shoftim?
I believe Rambam is clear a to why they are in Sefer Hamitzvot, Mitzvah 187:
היא שצונו להרוג שבעה עממין שישבו בארץ כנען ולאבדם, שהם שורש ע"ז ויסודם הראשון. והוא אמרו יתעלה החרם תחרימם. ובאר לנו בהרבה כתובים שסבת זה כדי שלא נלמוד מכפירתם. והנה באו כתובים רבים לרמוז על זה רוצה לומר על הריגתם לחזק בזה, ומלחמתם מלחמת מצוה.
And that is that He commanded us to kill the seven nations that dwelled in the Land of Canaan and to destroy them, since they are the root of idolatry and its first base. And that is His, may He be exalted, saying, "you must surely annihilate them" (Deuteronomy 20:17). And He explained to us in many verses that the reason for this is so that we do not learn from their heresy. And many verses come to hint about this - meaning their killing - to strengthen it; and the war against them is a commanded war.
The war of the 7 nations is the quintessential Milchemet mitzvah! It is a war that God literally commanded us explicitly to wage. We think of a Milchemet Mitzvah as a war that we decide to wage, for a proper purpose, that meets certain criteria, such as having a king. But it also certainly includes a war that is an explicit mitzvah in the Torah.
Now, not all the wars in sefer shoftim are with the 7 nations. But I am unsure as to why there is an asumption those were a milchemet mitzvah.