At the end. In effect, since the rankings take place over a 'year,' his results from this year's US Open replaces his result from last year's US Open.
So technically yes, even if he does win the US Open, he would still lose ground, since Nadal did better in this year's US Open then he did in last year's, so he will gain points equivalent to the difference between this year and last, where, if Federer wins, his point total will remain unchanged.