Is the underlying form of "n" /n/ or /ŋ/ in words ending in -nk?

There can be different vowel allophones before /n/ and /ŋ/

As long as we assume that /n/ and /ŋ/ are both phonemes of Modern English, there doesn't seem to be any good reason to suppose that word-final [ŋk] is underlyingly /nk/ instead of /ŋk/.

One argument for analyzing words ending in -nk as containing /ŋ/ is that the quality of vowels before -nk and -nt can differ in a similar way as how the quality of vowels before -ng and -n can differ.

For example, some speakers either hear, pronounce, or both hear and pronounce the vowel in words like sing as something like [i], in contrast to the [ɪ] found in sin. For these speakers, my understanding is the quality of the vowels in pink and pin generally differs in the same way: pink sounds like it has [i] versus the [ɪ] in pin.

A related form of allophony that some speakers have is a palatalized offglide in words like bank and hang compared to ban and hand or ham: this may occur to the extent that the vowel in bank and hang is identified with the "face" vowel (the vowel in bane and paint).

A simple way to explain these facts is to say these vowel quality changes are conditioned by following /ŋ/.

If we explain the vowel differences with this rule, it gives us a criterion for distinguishing underlying /ŋk/ from underlying /nk/. The latter only occurs word-medially, and only across separate syllables, as /n.k/.

For speakers with [iŋ], the contrast between /n/ and /ŋ/ is apparent in the use of a vowel with a quality more like [ɪ] in at least some in- prefixed words like income and ingrate (I'm not sure which specific examples of words like this have [ɪ]); this shows that these words underlyingly have /n/ and not /ŋ/, even if the nasal consonant could potentially sound a lot like [ŋ] on the surface due to gestural overlap (see my answer at Why do dictionaries transcribe the nasal in 'think' and 'language' with /ŋ/, yet 'input' and 'inbox' with /n/, not /m/? for further elaboration). Compound words like pancake are another context where you might find underlying /nk/ in contrast to /ŋk/.

There is an analysis where [ŋk] is /Nk/ (not /nk/)

Nasals are a common example for illustrating the theory of "archiphonemes".

Since there is no possible contrast between word-final /nk/ and /ŋk/, rather than saying the cluster is the latter, we could say that the nasal doesn't have an underlying place specification that is separable from the place specification of the following plosive /k/. The transcription "/N/" (capital n) represents a nasal with an unspecified place of articulation.

I don't know whether the concept of "archiphonemes" is currently popular.

There is an argument that underlying /ŋ/ doesn't exist

It's possible to say that even in modern English, /ŋ/ is not an underlying phoneme. Some sources argue that words like sing, singer still have underlying /ng/ that is realized in this context as [ŋ]. In this kind of analysis, think would in fact end in /nk/ (realized as [ŋk]).

Accents of English: Volume 1, by John C. Wells, discusses the generativist analysis of [ŋ] as /n/ or /ng/ in section 1.2.11 (starting on page 60).