Did John the Baptist Believe that Jesus was God?

Yes, John the Baptist believed and knew that Jesus Christ was almighty God.

In the beginning of his ministry, John declared, “Repent for the kingdom of heaven is at hand!” Matthew confirmed that John was “he of whom Isaiah the prophet spoke saying, ‘The voice of one crying in the wilderness, “Prepare the way of YHWH; make His paths straight!”‘” John quoted God’s words through Isaiah the prophet that the One whose way was to be prepared, was YHWH, the almighty God.

Indeed, John told the crowds, including the religious hypocrites who came comparably to those God described to Ezekiel in 33:32, that He Who was coming after John, was mightier, that He would judge and punish, and that John as God’s prophet was unworthy to carry His shoes. (Matthew 3) John recognized that he had need to be baptized by Jesus, and in John 1: 15, 27, and 30, is recorded as having stated clearly and repeatedly that Jesus both “was” before John who had been conceived months prior to Christ, and that Jesus was “preferred” ahead of John, meaning that He had much greater stature in the eyes of God. Only One who existed outside of matter and time, could live prior the conception of His own body and before a person who was conceived before He had been.

While John did not fully understand the mystery of Christ, his words demonstrate that he knew that the One to come was God, and that the One Whom he was commissioned to announce was the God he awaited.