Mike Resnick's Starship Mutiny?
The starship Theodore Roosevelt is fighting on the far outskirts of a galactic war, its crew made up of retreads and raw recruits. A new first officer reports, Wilson Cole, a man with a reputation for exceeding his orders (but getting results). He's been banished to the Teddy R. for his actions, but once there he again ignores his orders. ...
I found this by searching "sci-fi novel mutiny on military spaceship" on Google; this page was the 3rd result. You can read more about it at Goodreads:
Set well into the future when mankind is at war with the Teroni Federation, one naval officer finds reason to mutiny (hence, the first book, "Starship: Mutiny". Over time he becomes a pirate (book two: "Starship: Pirate"), a mercenary (book three: "Starship: Mercenary"), then rebels formally against the human government (book four: "Starship: Rebel") and finally takes on the humans directly (book five: "Starship: Flagship").
And on SF Reviews:
Wilson Cole is a highly decorated commander in the Republic Navy who, for his sins (a penchant for insubordination and ignoring orders he thinks are stupid), is transferred to the Teddy Roosevelt, a ship patrolling the remote and sparsely populated galactic rim. The Teddy R, as its crew refer to her, is the basket into which the Republic has dumped all its bad apples. Its crew are a bunch of drug-addicted wastrels, its captain is a burnout and its first officer an inflexible and hard-headed martinet. As second officer aboard this lemon, Cole is determined to make lemonade, so he sets about getting the Teddy R and its ragtag crew shipshape as best he can.
Cole's example has fired up the Teddy R's once-complacent and lax crew and even its fatalistic captain, but the first officer, Podok, remains Cole's bĂȘte noire. Things get worse when, in a later engagement, the captain is killed and Podok is given command of the ship. Cole is forced to choose between difficult loyalties: to the crew, who are unreservedly on his side; to the Navy, which seems all too eager to betray their faithful officers if political sensitivities demand it; to his increasingly unhinged new captain; even to the Republic itself, whose fickle and sensationalist media (why, so like our own!) all too easily mold ignorant public opinion.