Zahir al-Din Abu'l-Hasan Ali ibn Zayd-i Bayhaqi (Persian: ظهیرالدین ابوالحسن علی بن زید بیهقی; ca. 1097 – 1169) also known as Ibn Fondoq (ابن فندق) was an Iranian polymath and historian of Arab descent. He is the author of Tarikh-i Bayhaq.
In 1114, Bahyaqi along with his father visited Omar Khayyam, the famous Persian mathematician and astronomer, in Nishapur and while there Bayhaqi began his education in literature and science. He moved to Marv to complete his studies in Islamic jurisprudence by 1123. He returned to Nishapur in c.1127 where according to Yaqut al-Hamawi, his studies were "interrupted by marriage".
Bayhaqi became the qadi of Bayhaq through the efforts of his father-in-law, Shehab-al-Din Moḥammad b. Mas'ud, along with patronage from the Seljuq Sultan Sanjar. He may have made some enemies while in charge, he soon grew tired and resigned.
Bayhaqi then traveled to Ray and devoted himself to mathematics and astrology, and later studied in Nishapur to improve his understanding of astrology. While living in Sarakhs he squandered all of his money, and returned to Nishapur.
After an attempt to establish himself in Bayhaq failed "because of his relatives’ envy", Bayhaqi finally returned again to Nishapur and settled down to life in the seminary and the mosque.
In 1148, Demetrius I of Georgia presented inquiries ("of unknown purport") in Syriac and Arabic to Sultan Sanjar through an envoy. Bayhaqi was given the task of responding to Demetrius' inquiries by Sultan Sanjar.
Bayhaqi authored over 70 works ranging from Arabic grammar to astrology to philology.