The U.S. has and still is cooperating with various military dictatorships around the world. Obviously we would prefer to see them democratized, but we are doing it because we have national interests, whether it's working with Pakistan on Afghanistan or whatever.
Israel has military capabilities including nuclear weapons, far surpassing any other power in the Middle East, but it's a small country. The rest of the Middle Eastern peoples are Muslim and Israelis are not, so it is hardly in any position to become the leading power.
Obviously Pakistan and the U.S. are very different countries, but we have common geopolitical interests in preventing communist take over in Afghanistan and hence, now that Pakistan has a government that we can cooperate with, even though it is a military government, we are working together with them in order to promote our common interests. But obviously we also differ with Pakistan on a number of issues.