The US ambassador to Turkey has slammed the government of President Recep Tayyip Erdogan over the arrest of a consular staff member.