MADRID, Spain (AP) _ A Spanish army colonel accused of seeking money from Libya to finance right-wing terrorist activities has been formally charged with leaving his assigned post, the Defense Ministry said Monday.

It issued a statement saying the charge was filed against Col. Carlos de Meer Ribera in a ruling by a military judge, Joaquin Valenciano. If convicted, the military justice code provides for punishment ranging from six months to six years in jail.

De Meer Ribera was arrested Friday following an investigation that began in Januray after he allegedly met in Madrid with the Libyan consul-general , Saad Ismail, and then traveled to Libya to meet with Libyan leader Col. Moammar Khadafy.

Spain's Socialist government, in announcing de Meer Ribera's arrest, also said it had expelled Ismail for arranging the clandestine meeting between Khadafy and de Meer Ribera. It said Ismail had taken part ''in activities incompatible with his diplomatic status.''

A government announcement said Ismail left Spain Saturday.

De Meer Ribera is being held in a military prison in Alcala de Henares east of Madrid awaiting trial. The ministry statement did not indicate when the trial might begin.