I think Karl above has a good start to an algorithmic answer here. But I don't think you even look at divisibility or inclusion-exclusion. I think you actually find every value of $i$ but in a faster way, without checking every $i < N$--just enumerate the possible values of $\{i \mid \omega(i) = k\}$ via multiplication. For the sake of an algorithm, I think you treat the factorizations in their exponent array/vector form; for instance
$$1260 = 2^2\cdot3^2\cdot 5^1\cdot7^1 = [2,2,1,1] \\43472 = 2^4\cdot3^0\cdot 5^0\cdot7^0\cdot11^1\cdot13^1\cdot 17^0\cdot19^1 = [4,0,0,0,1,1,0,1] $$
I'm not an algorithm-optimization person. But here's what I'd do (for $k=4$), because I think it gets you to stop points in the shortest time.
Start with the initial array $[a_2, a_3, a_5, a_7] = [1,1,1,1] = 2\cdot3\cdot5\cdot7 = 210$. Determine the number of different lists of values where all of the elements are $1 \leq a_i \leq 2$ and at least one value is $a_i = 2$. These are: one $2$, two $2$s, three $2$s, and four $2$s.
For each of those possible lists, generate all the permutations, in reverse lexicographical order. This would get you (eliminating brackets and commas for space reasons):
$$2111, 1211, 1121, 1112; 2211, 2121, 2112, 1221, 1212, 1122; 2221, 2212, 2122, 1222; 2222$$
At each step, of course, generate the actual numbers:
$$420, 630, 1050, 1470;\\ 1260, 2100, 2940, 3150, 4410, 7350;\\ 6300, 8820, 14700, 22050, 44100$$
and add to a counter if the number is less than $N$. In each group you can stop when you hit a number that's too high.
Now do the same thing for $1 \leq a_i \leq 3$, with at least one value $a_i = 3$, and so on. You'll want some recursion, and also some recursion. For $n = 10^{16}$, for instance, at the very least $[46,1,1,1]$ and $[44,2,1,1]$ are possibilities.
But eventually you'll hit a point where none of the possibilities is less than $N$. I suggested reverse lexicographical order, as you should hit the smaller numbers earlier each time around. You'll never even try, for instance, $[10,10,10,10]$
Now you add another element to the array to represent $11$, and do the same thing, with the constraint that only four elements can be non-zero. Then add another element for $13$, etc. Eventually you should hit a point where nothing is under $N$, probably when your array looks like $[0,0,....,0,1,1,1,1]$ and the last four elements are the last four primes before the fourth root of $N$.
I may come back later and try to pseudocode this.
Edit: some code available here for lex order, there's code at the bottom for anti-lex order but only in Java, but I'm sure you can generate similar code in your personal favorite language.