You are correct.
While there was some hardship in Norway during the First World War, in which Norway was neutral, there was no starvation and no direct attack from Britain. On the other hand, during the Napoleonic Wars Denmark-Norway and England were on opposite sides and British naval action blocked grain imports on which Norway depended.
Hamsun wrote several newspaper articles during the war elaborating on his dislike of the British. However, I have not been able to find any of these online. What I did find was this short article on the webpage of the Norwegian state broadcaster, written by Ingar Sletten Kolloen, biographer of Hamsun:
Men han hadde også en annen grunn som er vanskelig for oss å forstå i dag; for England på 1800-tallet og begynnelsen av 1900-tallet var det samme som Amerika er for mange i dag. England var den store imperiemakten, og England tuska til seg land etter land. De slo ned opprør og brukte vold og alle slags midler for å opprettholde imperier.
(...)
Hans foreldre opplevde jo hungersnøden da engelske skip blokkerte Norge, slik at ikke Norge fikk mat. Og det fortelles at Hamsun som guttunge lærte seg diktet "Terje Vigen" av Henrik Ibsen. Og da han deklamerte hvordan Terje Vigen ikke fikk mat, så rant tårene hos Knut Hamsun. Så dette er noe han har hørt av sine egne foreldre, og besteforeldre, hvordan de sultet i hjel også i Gudbrandsdalen, fordi England blokkerte Norge.
My translation:
But he also had a different reason which is hard for us to understand today; England in the 19th and early 20th century was the same as what America is for many today. England was the great imperial power, and England grabbed country after country. They struck down uprisings and used violence and all kinds of means to maintain empires.
(...)
His parents experienced the hunger when British ships blockaded Norway, so Norway was not able to get food. And it is said that as a kid, Hamsun learned Henrik Ibsen's poem "Terje Vigen" by heart. And when he declaimed how Terje Vigen could not get any food, Hamsun's tears were running. So this is something that he heard from his own parents and grandparents, how they starved to death even in Gudbrandsdalen, because England was blockading Norway.
Other sources corroborate this. The general dislike might have been amplified by World War One but the hunger reference appears to be specifically to the Napoleonic Wars. Terje Vigen is a famous poem referring to the hardships experienced in this war. The Scandinavian famine in the 1860s, mentioned in another answer, mainly affected parts of Sweden and Finland.