Two college friends of the surviving suspect in the Boston Marathon bombing were accused Wednesday of trying to cover up his involvement by removing evidence from his dorm room and a third was charged with lying to the FBI.

They were identified as friends of Dzhokhar Tsarnaev, 19, who has been charged with carrying out the bombing along with his brother, Tamerlan Tsarnaev, 26. The younger brother was a student at the University of Massachusetts at Dartmouth, where he became friends with the three people charged Wednesday.

The friends were identified in a federal complaint as Dias Kadyrbayev and Azamat Tazhayakov, both 19-year-olds from Kazakhstan who were in the United States on student visas, and Robel Phillipos, 19, of Cambridge, Mass. All are current or former students at U-Mass.-Dartmouth.

The two Kazakhs were accused of removing a laptop computer and a backpack containing empty fireworks from Tsarnaev’s dorm room and throwing them in a dumpster after learning of his suspected involvement in the bombing. Phillipos was charged with lying to federal investigators.

All three men appeared in federal court in Boston on Wednesday and agreed to voluntary detention. The next hearing is set for May 14. Attorneys for the three said outside the courthouse that their clients had nothing to do with the bombing and had cooperated fully with the investigation.

The three were not accused of involvement in the attack, but a footnote in court papers said that about a month before the bombing, Dzhokhar Tsarnaev told Tazhayakov and Kadyrbayev that he knew how to make a bomb.

The charges were accompanied by an affidavit by FBI agent Scott P. Cieplik that provided new details of Tsarnaev’s actions after the bombing and laid out how his friends, after recognizing him on TV as one of the suspects, allegedly tried to help him.

The bombing on April 15 killed three people and injured more than 260. About 5 p.m. April 18, law enforcement authorities released video and photographs from cameras near the scene that showed two suspects.

Kadyrbayev told the FBI that a few minutes later he received a telephone call from Phillipos, who told him to turn on the television because one of the suspects looked familiar. Kadyrbayev said that one of the suspects looked like Tsarnaev and that he texted Tsarnaev, saying he looked like the man on television.

Kadyrbayev and Tazhayakov, who share an apartment, had met Tsarnaev in foreign-student circles at the university. Tazhayakov’s attorney, Linda Cristillo, said in a statement that they were acquaintances, but the FBI affidavit described the two men as close friends of Tsarnaev’s who talked to him in the two days after the bombing.

Tazhayakov said Tsarnaev gave him a ride home from campus on April 16. Kadyrbayev told the FBI he met Tsarnaev outside his dorm on April 17 and noticed he had given himself a short haircut.

Shortly after being alerted to Tsarnaev’s resemblance to one of the suspects on April 18, Kadyrbayev, Tazhayakov and Phillipos went to Tsarnaev’s dorm room. Just before entering, Kadyrbayev showed Tazhayakov a text message from Tsarnaev — “I’m about to leave if you need something in my room take it.” Tazhayakov told the FBI he believed he would never see Tsarnaev alive again.

Tsarnaev’s roommate let them in and said Tsarnaev had left a couple of hours earlier, according to the affidavit. Inside, the men found a backpack containing seven fireworks tubes that had been emptied of explosive powder.

“Kadyrbayev knew when he saw the empty fireworks that Tsarnaev was involved in the marathon bombing,” Cieplik’s affidavit said. “Kadyrbayev decided to remove the backpack from the room in order to help his friend Tsarnaev avoid trouble.”

They also took Tsarnaev’s laptop computer and a jar of petroleum jelly, which they thought might have been used to bind the powder into a bomb, according to the affidavit.

The trio went to the apartment in nearby New Bedford, Mass., shared by Kadyrbayev and Tazhayakov and watched news reports about the manhunt for the suspects, according to the affidavit.

Kadyrbayev told the FBI that the trio decided to get rid of the backpack and fireworks. He said he put the material into a black trash bag along with refuse from the apartment and tossed it into the dumpster outside the building.

According to the affidavit, Phillipos initially told the FBI that he had not gone to the dorm. He acknowledged his role in his fourth interview, though he said he was taking a nap when the backpack was thrown in the trash.

The FBI tracked the dumpster’s contents to a landfill in New Bedford and found the backpack April 26. Inside were the empty fireworks tubes and a homework assignment from one of Tsarnaev’s classes. The FBI did not mention the laptop.

Kadyrbayev and Tazhayakov are accused of conspiracy to obstruct justice, charges that carry a maximum penalty of five years in prison. Phillipos, charged with making false statements to federal law enforcement officers, faces up to eight years in prison.

Tsarnaev and his older brother were at large for four days after the April 15 bombing. The elder brother was killed in a shootout with police in the early hours of April 19, and the younger brother was captured that evening. He faces charges that potentially carry the death penalty. They are also suspected of killing an MIT campus police officer on April 18.

The arrests Wednesday were part of an ongoing investigation by Boston law enforcement and the FBI into a network of people suspected of helping the bombers. Federal law enforcement officials have said in recent days that they are focused on several “persons of interest” in the United States and Russia.

Kadyrbayev and Tazhayakov were taken into custody April 20 at their apartment in connection with violations of their student visas. A neighbor said the men were led out of the apartment in handcuffs by federal authorities. The neighbor, who did not want her name used, said the authorities questioned her about a black BMW parked near the apartment with a fake license plate on the front featuring the college’s name and mascot, plus “Terrorista #1.” The car is registered to Kadyrbayev, the Associated Press reported.

“Great neighbors. Perfectly nice. Sweet. Soft. Real nice. Always talked to me,” the woman said of the two men. “They are peaches.”

Jenna Johnson and Julie Tate contributed to this report.