AR 350-1 specific states:
Based on the information provided it appears you may have been tested prematurely.
With regard to your comment about the flag action you should have been flagged immediately after failing the APFT. However it is possible to flag an individual later due to administrative oversight.
I would encourage you to put together the facts of your case and approach you command in a calm, factual and professional manner. If you were tested during the non testing period your command should invalidate the test and remove the flag as an erroneous flag any opportunities that you may have missed based on the imposition of the flag should be corrected as if the flag was never implemented.