  We study in detail a supersymmetric Peccei-Quinn model, which has a DFSZ and
a KSVZ version. The fields breaking the Peccei-Quinn (PQ) symmetry correspond
to flat directions (flaton fields) and have unsuppressed couplings when PQ
symmetry is unbroken. The models have interesting particle physics
phenomenology. The PQ scale is naturally generated through radiative
corrections; also, in the DFSZ case the $\mu$ problem can be solved and
neutrino masses can be generated. Cosmologically they lead to a short period of
thermal inflation making the axion an excellent dark matter candidate if one of
the flaton fields has a positive effective mass-squared at early times but with
too low a density in the opposite case.
  A highly relativistic population of axions is produced by flaton decay during
the subsequent reheating, whose density is constrained by nucleosynthesis. We
evaluate all of the relevant reaction rates and evaluate the nucleosynthesis
constraint. We find that the KSVZ model is practically ruled out, while the
DFSZ model has a sizable allowed region of parameter space.
