What determines a punt from a field goal attempt is the formation. From the rulebook:
Note: The restriction in (1) above does not apply if a team does not present a standard punt formation (an equal number of players on either side of the snapper in a tight formation, and one player split out wide to either side), or if, after the offensive team has assumed a set position, there is a shift, or a player goes in motion.
In a punting situation, a drop kick or place kick is not allowed.
Due to this, it could go two ways: 1) The ref rules it a fumble, recovered by the punter, followed by an illegal kick penalty (which actually happened in a 2010 Cowboys/Saints Thanksgiving game,) or 2) If it happens pretty quickly (like they kick the ball as it touches the ground) they would probably just rule it a botched punt and proceed as if the kick was simply shanked.
EDIT: Side note on the Cowboys/Saints game: After the illegal kick, the Saints were able to get possession of the ball before it went out of bounds, so they declined the penalty and were awarded possession at the spot of the recovery.