Ricardo A. Martinelli is accused of diverting $13.4 million from social programs to buy software to track business competitors and political rivals.