You're almost certainly thinking of F Troop (1965–1967). The sitcom follows the 3rd U.S. Cavalry at Fort Courage in the post-Civil War West.
Captain Wilton Parmenter (Ken Berry) is a bumbling, accident-prone officer who only got his command because he sneezed during a battle, causing a Union victory. His soldiers—Sergeant O'Rourke (Forrest Tucker), Corporal Agarn (Larry Storch)—run scams with the local Hekawi tribe (led by Chief Wild Eagle, Frank DeKova). "Battles" are staged for mutual profit.
It's broad, dated in its Native portrayals, but a classic of 60s sitcom absurdity. Two seasons, 65 episodes.