I'm pretty sure any law enforcement officer can arrest a sheriff who has broken the law.
But if the sheriff is with in the law he is the highest ranking and most powerful law enforcement officer with in his or her jurisdiction.
Yes even higher than the state police this is because a sheriff is elected not hired or appointed.
I believe a states Attorney General if elected would be the highest ranking officer within the state.
Not quite sure where a DA fits in there but should fairly high on the food chain.
Pat