NEW YORK — Caroline Ellison, the tech executive who ran Sam Bankman-Fried ’s hedge fund while sometimes dating him, testified Tuesday that he directed her to commit crimes before his cryptocurrency empire collapsed last November. She also revealed that her former boss and boyfriend thought he might be U.S. president someday. With Bankman-Fried looking on from his seat in the courtroom, Ellison, 28, testified at the New York City trial that she committed fraud, conspiracy to commit fraud and money laundering along with Bankman-Fried and others. “He directed me to commit these crimes,” she said of Bankman-Fried, when asked by a prosecutor about his involvement. Repeatedly, Ellison made clear that Bankman-Fried was behind the biggest financial moves in his companies, to the point that bitcoins he created were sometimes called “Sam’s coins.” She described him as “very ambitious” and envisioning eventually leading huge companies and using his money influentially. He even thought there was a 5% chance he’d become president someday, Ellison said. Assistant U.S. Attorney Danielle Sassoon asked her what he thought he’d be president of. “Of the United States,” Ellison answered. Shortly after Ellison’s highly anticipated turn on the witness stand began, she was asked to identify Bankman-Fried in the courtroom. Ellison stood and scanned the courtroom for a long minute, at first unable to spot him, before gesturing his way with a flip of her hand and saying he was “over there wearing a suit.” The appearance of Bankman-Fried, who sat at a table among his lawyers, has changed dramatically in recent months as he has lost weight and trimmed his well-known wild coif into a tightly cropped look more traditional among financial professionals. Bankman-Fried could face decades in prison if he is convicted of charges lodged against him when he was brought to the United States from the Bahamas last December. He has pleaded not guilty. Bankman-Fried, 31, was one of the world’s wealthiest people on paper, with an estimated net worth of $32 billion, when his cryptocurrency businesses collapsed as investors and customers sought to empty their accounts last November. Bankruptcy proceedings followed as prosecutors alleged that stolen funds were used to fund his businesses, make donations and contribute to political campaigns in the hopes of influencing cryptocurrency regulation in Washington. At one time, FTX was the second-largest cryptocurrency exchange in the world. Ellison testified under a cooperation deal that could win her leniency when she is sentenced. It could also be pivotal when the jury decides whether Bankman-Fried is guilty of fraud charges among seven counts in an indictment against him. Bankman-Fried has been jailed since August, when Judge Lewis A. Kaplan concluded that he had tried to influence Ellison and other potential trial witnesses and could no longer be trusted to await trial under a $250 million bond and confinement to his parent’s Palo Alto, California, home. As Ellison testified, several of her friends or online fans were in attendance at the courthouse. In an overflow courtroom where spectators could watch proceedings on a television monitor, some of them, smiles on their faces, rushed toward a screen to see her up close. Ellison, a Stanford University graduate, met Bankman-Fried while working as an intern at the investment firm Jane Street before joining his company after he formed Alameda Research in 2017. She then volunteered that they had “dated a couple years.” Ellison seemed composed throughout the testimony, even when it touched on her romantic relationship with Bankman-Fried. She said the executives were sleeping together by fall 2018 and had begun a romantic relationship by summer 2020. After a breakup, they resumed the relationship in fall 2021 before breaking up for good in spring 2022, she said. Eventually, Bankman-Fried installed Ellison as chief executive at Alameda, where she was paid $200,000 in salary with her biggest bonus of $20 million occurring in 2021. Ellison said Bankman-Fried set up systems that enabled Alameda to withdrawal unlimited sums of money from FTX accounts and he “directed us to take FTX money to repay our loans.” She said Alameda eventually withdrew up to $14 billion from FTX, although some of it was paid back. Some of the money, she said, went to political donations, including $35 million funneled through one political operative to Republican candidates and another $10 million that Bankman-Fried steered to President Joe Biden, money that she said Bankman-Fried thought bought him a measure of influence and recognition. Ellison’s testimony immediately followed two days of testimony from Gary Wang, an FTX cofounder and another key figure in Bankman-Fried’s inner circle. He also testified under a plea agreement with prosecutors that he was directed by the defendant to set up software loopholes that allowed Alameda to drain FTX accounts of unlimited funds.