Dalkeith High School was previously the historic Dalkeith Grammar School. A list of masters of the Grammar School at Dalkeith (located on the High Street) commences at 1582. No other reference is made to the age of the school. An extract from the National Gazetteer, 1868 says: "The parish school, otherwise known as the grammar school, has long borne a high character among Scottish seminaries; beside the usual branches of a classical education, French, German, Italian, and mathematics are taught."  Alexander Bower suggests in his History of the University of Edinburgh that "for upwards of a century, [it] maintained a distinguished reputation, as being one of the best seminaries in Scotland for acquiring a knowledge of classical learning". Archibald Pitcairne (1652–1713), the physician, studied at Dalkeith Grammar School  as did Alexander Wedderburn, 1st Earl of Rosslyn (1733–1805) who went on to become Lord Chancellor, and Rev. William Robertson (1721–93), historian and later Principal of the University of Edinburgh. The naval tactician John Clerk of Eldin (1728–1812) was also a pupil.
In 1914 the Grammar School moved from the High Street to a location at King's Park School. The Newmills Road site (designed by William Scott (1870–1951)) was first used in 1940 and in 1960 the large extension to the rear was opened to a design by Reid & Forbes. The school buildings were closed in September 2003. The buildings were category B listed. Attempts to utilise them for other purposes were unsuccessful, in part because the newer building was severely contaminated with asbestos. In July 2009, Midlothian Council proposed demolition. Developing the location close to the centre of Dalkeith was felt could "assist greatly in promoting much needed economic development".
In November 2003, Dalkeith High was integrated into the Dalkeith Schools Community Campus along with St. David's Roman Catholic High School and Saltersgate School, a special education facility, making it the first such joint secondary school campus in Scotland. After the move, teachers kept students separated from each other in the dining hall and on the playground, citing concern that younger pupils might become disoriented by the sudden transformation of their small school into a large, integrated organisation with 2,200 youths. They initially predicted that the regime of segregation could be relaxed within a few weeks, and that religious factors played no role in their decision; by January 2004, teachers at Dalkeith and St. David's still told their pupils not to talk to pupils from the other school, and students were kept segregated due to threats of violence directed at one another and teachers of different religious backgrounds in addition to assaults.
The school's old building was demolished in January 2012. Midlothian Council spent £3,000 on lighting and £10,000 on security between 2004 and 2007, leading to criticism from local Conservative and Green Party politicians. Prior to the decision to demolish, the council had believed it was near an agreement to sell the property (2007)  to Taylor Wimpey to convert the building to 63 flats, together with 110 new flats on the site. Taylor Wimpey withdrew their planning application in February 2008 and their intention to purchase in March 2008 citing asbestos contamination as the determining factor.
Dalkeith High has produced a number of significant figures, including the meteorologist James Stagg (1900-1975), the distinguished Marxist geographer and critic, Neil Smith (1954–2012), the missionary Andrew Ross (1931–2008) and the musician Fish.
- "Site Record for Dalkeith Grammar School Dalkeith High School; Gibcon PlasticsDetails Details". rcahms.gov.uk.
- "GENUKI: Dalkeith, Midlothian - Extract from National Gazetteer, 1868". genuki.org.uk.
- Volume 3, p298, The History of the University of Edinburgh: Chiefly Compiled from Original Papers and Records, Never Before Published, Volume 3, 1830
- Alexander Campbell, A Journey from Edinburgh Through Parts of North Britain: Containing Remarks on Scotish [sic] Landscape; and Observations on Rural Economy, Natural History, Manufactures, Trade, and Commerce, 1802, p 5.
- "Dictionary of Scottish Architects - DSA Building/Design Report (May 3, 2015, 8:34 pm)". scottisharchitects.org.uk.
- Midlothian Council Planning Committee, Tuesday 12 January 2010, Item No 7.
- Harris, Gillian (22 January 2004). "Lesson in bigotry as pupils shun integration". The Times. London. Retrieved 15 February 2008.
- "School segregation defended". BBC News. 3 November 2003. Retrieved 15 February 2008.
- Devlin, Kate (1 June 2007). "Disused school kept lit to protect intruders". The Daily Telegraph. London. Retrieved 15 February 2008.
- Mitchell, Don (23 October 2012). "Neil Smith obituary". The Guardian. London.
- "The Rev Andrew Ross: Missionary and Church historian". The Independent. London. 3 September 2008.
- "Official Fish site: Biographies - Fish". fish-thecompany.com.