The officer can write the ticket if the officer has probable cause to believe the offense was committed. You can demand a trial and make the state prove its case. At the trial the judge will decide who is more credible and decide whether or not the government proved you were driving improperly. This response is for informational purposes only and is not offered as legal advice.
More often than not, police officers do not witness an accident, but instead, are dispatched to the scene of the accident after it has already occurred. The police then conduct an investigation which includes an analysis of the accident scene and taking statements of the drivers and witnesses. After conducting that preliminary investigation, the police may issue a traffic summons to one (or sometimes both) of the drivers based upon "information and belief." So yes, a police officer can give a moving violation ticket even if he did not witness the accident.
This happens all the time. Routinely, police officers investigate incidents and base their conclusions on the witnesses' statements and the evidence found at the scene.
But more importantly, how can you get out of the ticket? There are two issues you are facing. First, if the ticket sticks, it may be able to be used against you in a civil claim if the other side claims personal injury or property damage. Second, it could have a significant impact on your insurance premium. There is more information I would need to be of assistance in getting you off the hook for the ticket or to minimize the impact it can have on both of the above issues.