Quoting from the Emacs manual:
The start of the local variables list should be no more than 3000 characters from the end of the file, and must be on the last page if the file is divided into pages.
So to make sure your in text local variables will be ignored, add a page break (C-q C-l) before the real list of local variables or at the end of the file if you don't have local variables:
or at the end of your file:
#+BEGIN_SRC emacs-lisp
! Local Variables:
! mode: f90-namelist
! End:
#+END_SRC
^L
This will work for all local variables, not only the major mode.
If you don't want to export the page break, just comment it, as suggested by @lunaryorn.