Am I correct in thinking that the question is OK?
It's really up to you to determine if there's too much code to review. By casting the "invalid flag," you're communicating that you disagree with the original flag. In this case, it means that you disagree that it's too much code (or too much content overall). But in cases where you agree with it, then you would simply not cast an additional flag and perhaps just leave a comment out this for the OP.
Was my specifying "invalid flags" therefore correct (did I use that correctly)?
Other than just ignoring the original flag (which is okay), that's all you can do. As a user with moderator tools, you're not obligated to respond to every flag that ends up in the queue. The community moderator tools are there to assist the diamond moderators in making their decision.
Why would that be disputed (surely no-one else thinks that the question is off-topic)?
This is the expected outcome when an "invalid flag" is cast. It means that one or more community moderators disagree with the original flag, thus there are "disputes" on the flagged content.
However, now that diamond moderators can respond to individual flags ("invalid flags" being collected together), these can be cleared as helpful or rejected, but we're not obligated to do that.
In cases like these, a diamond moderator can just clear the entire post as helpful or rejected, which will still result in disputed flags. As long as there's at least one "invalid flag" cast, this will be the outcome.
What's the effect if any on my flag history of having several such items marked "disputed"?
Disputed flags have no effect on your flag history. Only declined flags can hurt you, if you have too many of them. Having many disputed flags just means that you've cast many "invalid flags" and nothing else. While they're still not considered helpful in the systematic sense, they are not harmful.