The prehistory of Dirleton is represented by iron age settlements and burials and by a record of a fort on Craigs Hill to the west. It is likely that a settlement had become established by the seventh century in the upper part of the current village.
In the mid-twelfth century King David l of Scotland gave the lands of Dirleton to the Anglo Norman de Vaux family who initially settled at Eldbotle, a mile northwest of the current village, and built a church at Gullane. Around 1240 they built Dirleton Castle, one of the early stone castles in Scotland. It was damaged during the Wars of Independence in the late thirteenth century but rebuilt by the Haliburton family and extended by the Ruthvens who also added the dovecote and gardens. Oliver Cromwell severely damaged the castle in 1650. Fortunately the principal parts of the de Vaux castle have survived.
Sir John Nisbet acquired the Dirleton Estate in 1663 and built Archerfield House which his descendants twice modified and extended. It was badly damaged when occupied by troops during World War II but in the early twenty-first century it was restored as the centrepiece of a golf and residential development.
The church at Gullane ceased to meet the needs of its parish in1612 and was abandoned in favour of a new church at Dirleton. The manse was moved eighteen years later to the west side of Dirleton Green and is now known as the Old Manse. The church was funded by local landowners and was responsible for education and support of the poor until, in later centuries, they were taken over by local government.
The economy of Dirleton has historically been based on agriculture, initially a peasant system but replaced by a few farms heavily dependent on manual labour. Since the mid twentieth century mechanisation has radically reduced the need for employees. The village has mainly become a dormitory for people working elsewhere.