The ideal state is the Islamic state under Prophet Muhammad (peace be upon him).
To know how to run the ideal state, we should study the Islamic state under Prophet Muhammad (peace be upon him) and the first four Caliphs.
Obviously, the early Muslims weren't naïve hippies. They fought and they defended themselves but they weren't amoral either.
If what Machiavelli said contradicts Quran and Sunnah then we have to follow Quran and Sunnah. I have a copy of The Prince and there are bits that don't go against Quran and Sunnah. Not all of it is teaching immorality.
But the overall idea I think is that the ruler should just abandon morals and embrace an amoral philosophy, similar to Nietzsche.
Not only is that approach wrong but I don't even think it's effective. If you have no morals, people will find out and you'll get a reputation for it. People won't trust you and you won't have real friends. If you're the ruler, the people might not be loyal and you might overthrown and/or assassinated the moment you let your guard slip.
But not all of his ideas were necessarily wrong or immoral. For example, is it better to be loved or feared? I think he said both is ideal but if you can only get one, then fear is good. I don't think this is necessarily wrong. Potential criminals might not love the sharia but the punishments may scare them away from committing crimes like zina.