The account of God's dealings with Ahab is a confusing one, because at first glance, it seems out of step with God's character. Did God really send a lying spirit in order to deceive Ahab? How is this possible from the God who cannot lie (Titus 1:2)?
First, it is important to note that Ahab was a particularly evil man. We all sin, but according to 1 Kings 16:33, Ahab did more to make God angry than any other king of Israel before him. God sent him warnings through His prophets, yet rather than repent, Ahab blamed the prophets, even to the point of killing them. God actually gave Ahab some very solid proof of His sovereignty. He sent Elijah, His prophet, to contest with the prophets of Baal, the god Ahab worshipped. Ahab's prophets failed the test, and Elijah proved God because God was the one who sent fire from Heaven to consume the altar. This would have been the perfect time for Ahab to throw up his hands in surrender. He did not.
After several attempts to make Ahab repent, Jehoshaphat, the king of Judah asked if Ahab would join him in battle against the Syrians. Ahab agreed, but Jehoshaphat suggested the will of God be sought. So Ahab gathered 400 false prophets to say yes, Ahab and Jehoshaphat would win, but Jehoshaphat figured they were false prophets. Therefore, he asked if there were any true prophets of God to consult. Ahab said that Micaiah was a true prophet of God, but he hated him, because he never gave good prophecies. But Micaiah was indeed consulted, and through him, God gave Ahab some insight into what was going on in the spiritual realm. This is where the lying spirit comes in.
The first thing to note here is that God Himself is not the lying spirit. He asks the spirits if any of them would volunteer to persuade Ahab to go to battle. The lying spirit volunteers, so God asks him what he will do, to which he says "I will go out and be a lying spirit in the mouth of all his prophets". Thus, God is not the lying spirit. Rather, He accepted the lying spirit's plan. God's only direct influence here was to ask for a volunteer to persuade Ahab to go to battle.
Furthermore, note how Ahab now knew this. God did send Ahab one true prophet. God told the truth to the prophet who in turn told the truth to Ahab, meaning even if the lie had come from God personally, it would not have actually been a lie. When you tell someone the truth about a lie, the only way they can be deceived is if they lie. This was Ahab's final chance at repentance. Unfortunately for him, he never took it. Ahab died in battle, just as God had warned.
What we see here, then, is nowhere near as disturbing as it seems at first glance. Rather than seeing God maliciously lying, what we actually see, first of all, is His patience. God could have dealt with Ahab any way He chose. At the very first sign of iniquity (or even knowing the iniquity would have happened), God could have destroyed Ahab in any way He chose. Sickness, animal attack, poison, being omnipotent makes God's options basically limitless. Instead, He sent several warnings to Ahab. God's mercy to Ahab was incredible. Second, even the lying spirit, which was not God, nor was he told directly by God to lie, was revealed to Ahab in one final act of mercy from God. Ahab had one final chance to repent, but he never took it. Ultimately, God's Holiness and sovereignty are shown through the account of Ahab. We can learn a lot from it.