Tory Lanez is ripping his former attorney apart in a formal ethics complaint to the State Bar of California ...

claiming she didn't have his best interest at heart when she represented him in his criminal case over the Megan Thee Stallion shooting!!! TMZ Hip Hop obtained Tory's complaint, in which he says his former attorney Shawn Holley abandoned him when the going got tough in his criminal case -- but not before paying her a few pretty pennies!!! The incarcerated "Say It" singer claims he took on Holley to represent him without knowing she had business ties to Megan's record label, Roc Nation. Tory cites Hulu's hit series "Reasonable Doubt" as the source of her conflict of interest. He says Holley served as one of the principal producers on the show, which is loosely based on her life as a celeb attorney.

Megan and Beyoncé 's Grammy Award-winning collab "Savage (Remix)" was featured in season 2 of the show, as was a track from Holley's daughter Nayanna , who has sung backup for Beyoncé in the past. Tory says Roc Nation CEO Desiree Perez was allowed to assist Megan in giving police statements, and claims Holley left him high and dry when she quit representing him on December 18 ..

. just 5 days before the guilty verdict ..

. but after Tory says he paid her between $200K-$300K to retain her services!!! Tory says his refusal to take a guilty plea caused Holley to neglect fighting for his innocence, including by allegedly telling his DNA expert not to perform extensive studie.