Muhammad was a member of the Quraish tribe, which controlled the Kaaba in Mecca. Prior to Islam, the Kaaba was an important pagan pilgrimage site. So that suggests at least what his cousins and extended family may have believed.
Today the Kaaba is the official direction of Muslim prayer and all mosques and prayer locations will have a qibla to orient the supplicant towards the Kaaba (in some Western countries, the qibla is sometimes shorthanded by non-Muslims as pointing "east"). But prior to being the Muslim center of the world, it was a pagan site for centuries.
The Quraish took control of the site generations before Muhammad, and profited from that position. The Quraish generally followed a polytheistic pantheon. The Quraish wiki article quotes The Oxford Handbook of Late Antiquity:
The Qurayshite pantheon was composed principally of idols that were in the Haram of Makka, that is, Hubal (the most important and oldest deity), Manaf, Isaf, and Na'ila.
The wiki article also summarizes Abdullah Saeed, The Qur'an: An Introduction as stating that the Quraish had a pantheon of one higher God with multiple lesser Gods.
Note that the Quraish also formed the early opposition to Muhammad. The earliest stages of the religion were a quarrel over possession of Mecca and the Kaaba, so naturally the more powerful elements of Quraish opposed Muhammad, who was not from the most powerful elements of the tribe. He fled to Medina but eventually defeated Mecca and pardoned his tribesmen, who became early Muslims.
I'm not sure how much that tells you about what historical Muhammad may have believed, but it gives you some sense of the broader social environment.