Dynamics of ghost scalar fields in Kaluza–Klein cosmology