A Prime Minister's "term" is traditionally regarded as the period between their appointment and resignation (or dismissal), with the number of general elections taking place in the intervening period making no difference.
The only Prime Minister to serve three terms was Sándor Wekerle (17 November 1892 - 14 January 1895, 8 April 1906 - 17 January 1910, 20 August 1917 - 30 October 1918).