The history of Dobre Miasto goes back to the Middle Ages, when Dobre Miasto was founded at the beginning of the 14th century. It replaced the former settlement of a Prussian tribe on an island on the river Łyna. It was incorporated on 26 December 1329. Defensive walls surrounding the town were erected a few years later. The walls, with many watchtowers, also had three gates: Głotowska, Ornecka and Ł±kowa. Today, all that remains of the former fortifications is the Stork's Watchtower or Baszta Bociana.
Dobre Miasto formed part of the Warmia Diocese, established in 1243 with the conquest of Prussia by the Teutonic Knights. Between 1466 and 1722 Dobre Miasto was part of the Polish state. During the war between Poland and the Teutonic Order (1519-1521) troops of the Grand Master Albrecht Hohenzollern occupied the town and plundered the vault of the collegiate church. From 1626 to 1629 the town was occupied by the Swedish army of the Gustaf Adolf.
The establishment of the Collegiate Chapter in Dobre Miasto was of vital importance for the town. During the next few decades, the canons built a collegiate church, a parish church and a hospital. Work on extending the town’s fortifications started at the same time as the construction of the collegiate church.
In the 19th century, for about 30 years, Dobre Miasto was the county seat. This was a time of intensive development: a factory of saltpetre was founded in 1852, in 1882 a cloth factory was established. The town acquired a railway connection with Olsztyn and Orneta in 1884. From 1823 to 1849 the town was the seat of the County Court of Justice; from 1879 it was the seat of the Regional Court. Dobre Miasto was spared the vicissitudes of the First World War. The town's development ground to a halt during the period between World War I and World War II. The main business operating in the town at that time was the agricultural machinery factory, established in 1905 (currently POL-MOT Warfama S.A.).
During the Second World War, the whole region was in upheaval. According to the 1945 census the population numbered 435. On 21st June 1945 Polish administration was established here in the Mazury District by the Government's Representatives. On taking control of the administration the Polish authority representatives found a ravaged land, depopulated towns and villages, burnt down houses and farm buildings, with damaged railway tracks and severed power lines. It was impossible for any business or industry to start production. Agriculture was practically devastated. The authorities’ main task was to work on the economic regeneration of the area. The after-war years were a time of rapid growth and development.