For punishment, Bart has to write Hieroglyphs on the chalkboard. If one looks closely, it has an eye, a well, a knot, a D- and a head. Translated this is, Eye Well Knot D Face, or I Will Not Deface. It is also reference to chalkboard gag.
This episode is non-canon and takes place on Easter Sunday.
Bart's line of "No, the bush set me up!" references the arrest of Marion Barry in 1990. While Marion was being arrested he exclaimed "No, the bitch set me up!"
The fantasy of Bart's dream was inspired by and references several films by Jerry Bruckheimer, particularly Die Hard and Lethal Weapon. It also uses various elements from other action films.
The story of Solomon comes before David and Goliath, but in the Bible it was the other way around. Also in the Bible, it says that Solomon is the heir and son of David.
Wiggum, in Bart's dream of David, asks the king David, "Where's your Messiah now?". But in the Bible, Jesus is descended from David's line and in Homer's dream Jesus is there, but Solomon was David's son and he was also an ancestor of Jesus.