Becoming a member of the faculty of advocates in 1763, he soon acquired a leading position at the bar; and he had the advantage of the success of his half-brother Robert (1713-1787), who had become lord president of the court of session in 1760. He became solicitor-general to Scotland in 1766; but after his appointment as lord-advocate in 1775, he gradually relinquished his legal practice to devote his attention more exclusively to public business. In 1774 be was returned to parliament for Midlothian, and joined the party of Lord North; and notwithstanding his provincial dialect and ungraceful manner, he soon distinguished himself by his clear and argumentative speeches.
After holding subordinate offices under the Marquess of Lansdowne and Pitt the Younger, he entered the cabinet in 1791 as home secretary. From 1794 to 1801 he was secretary of state for war under Pitt, his great friend. In 1802 he was elevated to the peerage as Viscount Melville and Baron Dunira. Under Pitt in 1804 he again entered office as First Lord of the Admiralty, when he introduced numerous improvements in the details of the department. Suspicion had arisen, however, as to the financial management of the Admiralty, of which Dundas had been treasurer between 1782 and 1800; in 1802 a commission of inquiry was appointed, which reported in 1805. The result was the impeachment of Lord Melville in 1806, on the initiative of Samuel Whitbread, for the misappropriation of public money; and though it ended in an acquittal, and nothing more than formal negligence lay against him, he never again held office. An earldom was offered in 1809 but declined.
His son and heir was Robert Dundas, 2nd Viscount Melville.
See Hon. JW Fortescue, History of the British Army, vol. iv (1907).