This is going to depend on what you think or know is on the phone, why you want to keep it undisclosed, and why the officer says s/he wants it. If one knows or has good reason to think that there is evidence of a crime on the phone, then destroying or hiding that evidence may be criminal.
If one gets a court order, such as a warrant or subpoena, to turn over evidence, destroying the evidence or otherwise failing to comply may well be criminal contempt of court, or another criminal offense.
In most circumstances an officer must have probable cause, and usually a warrant, to conduct a lawful search. But border searches are different.
That searches made at the border, pursuant to the longstanding right of the sovereign to protect itself by stopping and examining persons and property crossing into this country, are reasonable simply by virtue of the fact that they occur at the border, should, by now, require no extended demonstration. United States v. Ramsey, 431 U.S. 606, 616 (1977) (sustaining search of incoming mail). See also Illinois v. Andreas, 463 U.S. 765 (1983) (opening by customs inspector of locked container shipped from abroad).
The Congressional Research Service wrote: in the March 2021 report "Searches and Seizures at the Border and the Fourth Amendment" (pdf):
The Supreme Court has recognized that searches at the border are “qualitatively different” from those occurring in the interior of the United States, because persons entering the country have less robust expectations of privacy, given the federal government’s broad power to safeguard the nation by examining persons seeking to enter its territory. While law enforcement searches and seizures within the interior of the United States typically require a judicial warrant supported by probable cause, federal officers may conduct routine inspections and searches of persons attempting to cross the international border without a warrant or any particularized suspicion of unlawful activity. But a border search that extends beyond a routine search and inspection may require at least reasonable suspicion.
...
Recent years have seen legal challenges to border searches of electronic devices such as cell phones and computers, which
often contain more personal and sensitive information than other items frequently searched at the border, such as a wallet or briefcase. The Supreme Court has not yet addressed this issue. Lower courts have generally held that government officers may conduct relatively limited, manual searches of such devices without a warrant or any particularized suspicion. The courts, however, are split over whether more intrusive, forensic searches require at least reasonable suspicion.
...
Federal statutes and implementing regulations confer designated law enforcement officers with broad authority to conduct searches and seizures at the border and surrounding areas without a warrant. These searches commonly occur at designated ports of entry along the border, such as
border crossing points.[1] But searches may also occur in other places along or near the border.[2]
To enforce U.S. customs laws, federal law enforcement officers may inspect and search individuals, merchandise, vehicles, and vessels arriving at the border, as well as further into the
interior of the United States and within U.S. waters.
Under 19 U.S.C. § 1496, a customs officer may examine “the baggage of any person arriving in the United States in order to ascertain what articles are contained therein” and whether those items are subject to taxes or otherwise prohibited. Similarly, 19 U.S.C. §1467 allows customs
officers to inspect and search the persons, baggage, and merchandise arriving by vessel from a
foreign port (including U.S. territories).
If there is nothing that could be evidence on a phone, erasing it should not be criminal destruction of evidence, but this will be hard to prove after the fact, and border officials have authority to insist on a search with no warrant or particular suspicion.
Notes
[1]: See United States v. Cotterman, 709 F.3d 952, 961–62 (9th Cir. 2013) (describing a “border search” as one that
occurs at ports of entry where there is an actual or attempted border crossing);see also U.S. CUSTOMS AND BORDER
PROTECTION, Border Security: At Ports of Entry (last modified Apr. 2, 2018), https://www.cbp.gov/bordersecurity/ports-entry (describing U.S. Customs and Border Protection’s functions at ports of entry).
[2]: See United States v. Villamonte-Marquez, 462 U.S. 579, 593 (1983) (recognizing the government’s interest in
patrolling inland or coastal waters “where the need to deter or apprehend smugglers is great”); Almeida-Sanchez v.
United States, 413 U.S. 266, 268 (1973) (noting that the Border Patrol conducts inland surveillance activities “all in the asserted interest of detecting the illegal importation of aliens.”); See also U.S. Customs & Border Prot., "Border Security: Along U.S. Borders" (Jan. 17, 2018), https://www.cbp.gov/border-security/along-us-borders (describing the Border Patrol’s responsibilities along the border