Contour (curve) selection in the Ampere's circuital law
Its a very good question.
If the core are ideal, so relative permmeativity  is very high (infinite) and H is equal to zero.
I know its not answering your question but maybe its some direction to the solution.
Now I manage to refresh my memory with a little help from my notes...
As I mentioned before - in the ideal core the H field is zero because of an infinite relative permittivity.
so in both cases, the right side of the equation is equal to zero.
now, let's figure out the left side of the equation - NI... In an ideal core, the current needed to excite a finite magnetic flux is zero! this is because the magnetization inductance is infinite... So both of the equations are correct.