At the beginning of the 15th Century, the Lucerne von Moos family acquired the right to low justice in the village, which they relinquished in 1422 to Lucerne. After the conquest of the Aargau in 1415, the village came under the authority of the city of Lucerne and was part of the Meienberg district. In 1798 Dietwil's ties to Lucerne were severed. With the Act of Mediation in 1803, it became part of the newly created Canton of Aargau. In 1863 a decision of the Cantonal Council of Aargau naturalized all the gypsies who had settled in Dietwil after fleeing Napoleon's armies in Belarus.