Exhibit 5.1
![]() |
Sheppard, Mullin, Richter & Hampton LLP 30 Rockefeller Plaza 30 Rockefeller Plaza New York, New York 10112-0015 212.653.8700 main 212.653.8701 fax www.sheppardmullin.com |
October 9, 2026
The Purchasers (as defined below)
and
WallachBeth Capital, LLC
185 Hudson St., Suite 1410
Jersey City, NJ 07311
Ladies and Gentlemen:
We have acted as counsel to bioAffinity Technologies, Inc., a Delaware corporation (the “Company”) in connection with the execution and delivery by the Company of the Securities Purchase Agreement, dated as of October 8, 2026 (the “Agreement”), by and among the Company and the purchasers identified on the signature pages thereto (the “Purchasers”), in connection with the sale and issuance of (i) 116,545 shares (the “Shares”) of the Company’s common stock, $0.007 par value (the “Common Stock”), and pre-funded warrants to purchase up to 536,836 shares of Common Stock (the “Pre-Funded Warrants,” and the shares issuable upon exercise thereof, the “Pre-Funded Warrant Shares”), pursuant to an effective registration statement under the Securities Act of 1933, as amended (the “Securities Act”), and (ii) warrants to purchase up to 980,072 shares of Common Stock (the “Common Warrants,” and the shares issuable upon exercise thereof, the “Common Warrant Shares”) in a concurrent private placement. The Shares, the Pre-Funded Warrants, the Pre-Funded Warrant Shares, the Common Warrants and the Common Warrant Shares are collectively referred to herein as the “Securities.”
This opinion is given to you pursuant to Section 2(a)(ii) of the Agreement. Unless defined herein, capitalized terms have the meanings given to them in the Agreement.
In our capacity as counsel to the Company, we have examined, among other things, originals, or copies identified to our satisfaction as being true copies of the following:
| 1. | the Registration Statement on Form S-3 (File No. 333-275608) (the “Registration Statement”), which the U.S. Securities and Exchange Commission (the “Commission” or the “SEC”) declared effective on November 27, 2023, which registers the sale to the Purchasers of the Shares and the Pre-Funded Warrant Shares under the Securities Act; |
| 2. | the base prospectus included in the Registration Statement (the “Base Prospectus”); |
| 3. | the prospectus supplement dated October 8, 2026 and filed with the Commission on October 9, 2026 (the “Prospectus Supplement” and, together with and supplementing the Base Prospectus, the “Prospectus”); |
| 4. | the Certificate of Incorporation of the Company as amended and in effect on the date hereof (the “Charter”); |
| 5. | the Bylaws of the Company as amended and in effect on the date hereof (the “Bylaws”); |
| 6. | the Certificate of Good Standing for the Company as certified by the Secretary of State of Delaware on October 8, 2026 (the “Delaware Certificate”); |
| 7. | the resolutions of the Board of Directors of the Company, adopted on October 8, 2026, authorizing/ratifying the execution and delivery of the Agreement, the issuance and sale of the Securities, the preparation and filing of the Prospectus Supplement, and other actions with regard thereto, including the pricing of the Shares, the Pre-Funded Warrants and the Common Warrants as provided for in the Agreement; |
| -1- |

October 9, 2026
Page 2
| 8. | the executed copy of the Agreement; |
| 9. | executed copies of the Pre-Funded Warrants; |
| 10. | executed copies of the Common Warrants; |
| 11. | the other documents delivered on the Closing Date; and |
| 12. | such other records, certificates, documents and instruments, certified or otherwise identified to our satisfaction, as we have considered necessary or appropriate for the purposes of this opinion. |
As to matters of fact, we are relying upon the representations and warranties of all parties contained in the Agreement, the certificates of certain officers of the Company (the “Certificates”) and upon certificates and other communications of governmental officials, all without independent verification. In addition to the documents described above, we have examined originals or copies of other documents, corporate records and other writings we consider relevant for purposes of this opinion. In the examination of all such documents, we have assumed that the signatures on documents and instruments examined by us are authentic, that each is complete and what it purports to be, that all documents and instruments submitted to us as copies or facsimiles conform with the originals, and that the documents and instruments submitted to us have not been amended or modified since the date submitted.
In our examination of documents, we further assumed without any independent investigation that (i) each party to the Agreement, other than the Company, at all times relevant thereto, is validly existing and in good standing under the laws of the jurisdiction in which it is organized, and is qualified to do business and in good standing under the laws of each jurisdiction where such qualification is required generally or necessary in order for such party to enforce its rights under such Agreement, (ii) that each person or entity entering into such documents (other than the Company) had the power, legal competence and capacity to enter into and perform all of such party’s obligations thereunder, (iii) the due authorization, execution and delivery of such documents by each party thereto (other than the Company), (iv) the enforceability and binding nature of the obligations of the parties to such documents (other than the Company), (v) that there is no fact or circumstance relating to any party (other than the Company) that might prevent the Purchasers from enforcing any of the rights provided for in the Agreement, (vi) the genuineness of all signatures, (vii) that all of the representations and warranties of all of the parties to the Agreement as to matters of fact (including factual conclusions and characterizations and descriptions of purpose, intention or other state of mind) are true and correct in all respects, and (viii) that no action has been taken or event occurred which amends, revokes, terminates or renders invalid any of the documents, records, consents or resolutions which we have reviewed since the date hereof. We also assumed that there are no extrinsic agreements or understandings among the parties to the Agreement or Material Contracts (as defined below) that would modify or interpret the terms of the Agreement or Material Contracts or the respective rights or obligations of the parties thereunder.
As used in this opinion, the expression “to our knowledge” or “known to us” with reference to matters of fact refers to the actual knowledge of the attorneys within the firm who have given substantive attention to the Company’s affairs. After such consultation with the other members of our firm as we deem appropriate, but not including any constructive or imputed notice of any other information, we find no reason to believe that the opinions expressed herein are factually incorrect. Beyond that we have made no independent factual investigation for the purpose of rendering an opinion with respect to such matters except as otherwise specified in this opinion.
| -2- |

October 9, 2026
Page 3
We are opining herein as to the effect on the subject transactions only of (i) the internal laws of the State of New York, and (ii) the federal laws of the United States as applied by courts sitting in the State of New York. Notwithstanding anything to the contrary herein, we express no opinion with respect to (a) the laws of any other jurisdiction, or (b) any statutes, administrative decisions, rules, regulations or requirements of any municipality, subdivision or local authority of any jurisdiction.
Based upon and subject to the foregoing and the qualifications and limitations set forth below, it is our opinion that:
(a) The Company is validly existing and in good standing under the laws of the State of Delaware. The Company has all requisite power and authority to own and operate its properties and assets and to carry on its business as now conducted and as proposed to be conducted (all as described in the SEC Reports (as defined below).
(b) The Company has all requisite power and authority (i) to execute and deliver the Agreement, (ii) to issue, sell and deliver the Securities and (iii) to carry out and perform its obligations under, and to consummate the transactions contemplated by, the Agreement, the Pre-Funded Warrants and the Common Warrants.
(c) All action on the part of the Company necessary for the authorization, execution and delivery by the Company of the Agreement, the authorization, issuance, sale and delivery of the Securities pursuant to the Agreement, and the consummation by the Company of the transactions contemplated by the Agreement, has been duly taken. The Agreement, the Pre-Funded Warrants and the Common Warrants have been duly and validly executed and delivered by the Company and constitute the legal, valid and binding obligation of the Company, enforceable against the Company in accordance with their respective terms, except that (a) such enforceability may be limited by bankruptcy, insolvency or other similar laws affecting the enforcement of creditors’ rights in general and (b) the remedies of specific performance and injunctive and other forms of injunctive relief may be subject to equitable defenses.
(d) The Shares have been duly authorized and, when issued against payment therefor as set forth in the Agreement, will be validly issued, fully paid and nonassessable. The Pre-Funded Warrants and the Common Warrants have been duly authorized. The Pre-Funded Warrant Shares and the Common Warrant Shares, when issued by the Company upon exercise of the Pre-Funded Warrants or the Common Warrants, as applicable, against payment therefor in accordance with the terms thereof, will be validly issued, fully paid and nonassessable. To our knowledge, except as set forth in the SEC Reports, there are no other options, warrants, conversion privileges or other rights presently outstanding to purchase or otherwise acquire from the Company any capital stock or other securities of the Company, or any other agreements to issue any such securities or rights.
(e) The issuance and sale of the Securities pursuant to the Agreement, on the Closing Date are not subject to any preemptive rights or similar rights under the Delaware General Corporation Law (the “DGCL”) or pursuant to any material contract, agreement or instrument filed as an exhibit to (i) the Registration Statement or (ii) the Company’s Annual Report on Form 10-K for the year ended December 31, 2025, filed by the Company with the Commission on March 16, 2026, incorporated by reference into the Registration Statement and the Prospectus (each, a “Material Contract”).
(f) To our knowledge, the Company has filed all reports (the “SEC Reports”) required to be filed by it under Sections 13(a) and 15(d) of the Securities Exchange Act of 1934, as amended (the “Exchange Act”). As of their respective filing dates, the SEC Reports incorporated by reference into the Registration Statement and Prospectus complied in all material respects as to form with the requirements of the Exchange Act and the rules and regulations of the Commission promulgated thereunder.
| -3- |

October 9, 2026
Page 4
(g) The execution, delivery and performance of the Agreement, the Pre-Funded Warrants and the Common Warrants and the consummation of the transactions contemplated therein will not result in a breach or violation of any of the terms and provisions of, or constitute a default under, or result in the imposition of any lien, charge or encumbrance upon any property or assets of the Company pursuant to (i) the Charter or the Bylaws, (ii) the DGCL, (iii) any New York State or federal statute, rule, or regulation, or to our knowledge, any decree, order or judgment applicable to the Company (other than state and foreign securities or “blue sky” laws, as to which we express no opinion), or (iv) any Material Contract; except in the case of clause (iv) for such conflicts, breaches or defaults, which individually or in the aggregate could not be reasonably expected to result in a Material Adverse Effect provided, that we do not express any opinion as to compliance with the antifraud provisions of federal and state securities laws.
(h) To our knowledge, no consent, approval, authorization or other order of, or registration or filing with, any federal or New York court or other governmental or regulatory authority or agency that in our experience is normally applicable to transactions of the type contemplated by the Transaction Documents is required for the execution, delivery and performance by the Company of the Transaction Documents, the issuance and sale of the Securities being delivered on the Closing Date, or the consummation of the transactions contemplated by the Transaction Documents, except such consents, approvals, authorizations, orders and registrations or filings as may be required (i) under applicable state securities laws, as to which we express no opinion, (ii) the filing with the Commission of the Prospectus; (iii) the notice and/or application(s) to each applicable Trading Market for the issuance and sale of the Securities and the listing of the Shares, the Pre-Funded Warrant Shares, and the Common Warrant Shares; (iv) from the Financial Industry Regulatory Authority (FINRA), as to which we express no opinion.
(i) The Registration Statement was declared effective by the Commission under the Securities Act, and, to our knowledge, based on the information provided on the official website of the Commission at https://www.sec.gov/litigation/stoporders.shtml on the date hereof, no stop order suspending the effectiveness of the Registration Statement has been issued under the Securities Act, and no proceedings for that purpose have been instituted or, to our knowledge, pending by the Commission. The Registration Statement and the Prospectus and any post-effective amendments or supplements thereto (other than the financial statements included therein, as to which no opinion need be rendered) each as of their respective dates complied, and complies as of the date hereof, as to form in all material respects with the requirements of the Securities Act and the rules and regulations thereunder.
(j) Based in part upon the representations of the Purchasers contained in the Agreement, the offer, sale and issuance of the Common Warrants and Common Warrant Shares pursuant to, and in conformity with, the terms of the Agreement, constitute a transaction that is exempt from the registration requirements of Section 5 of the Securities Act of 1933, as amended.
(k) We confirm to you that we are not representing the Company in any pending action or proceeding, and we not aware of any such threatened action or proceeding, in which the Company is a named defendant and that seeks to enjoin the sale and issuance of the Securities or challenge the validity of the Transaction Documents or the performance by the Company of its obligations thereunder.
(l) The Company is not, and after the consummation of the transactions contemplated by the Agreement, and the issuance of the Securities, shall not be, required to register as an Investment Company under the Investment Company Act of 1940, as amended.
The opinions expressed above are subject to the following limitations, exceptions, qualifications and assumptions:
| a. | The effect of bankruptcy, insolvency, reorganization, moratorium and other similar laws relating to or affecting the relief of debtors or the rights and remedies of creditors generally, including without limitation the effect of statutory or other law regarding fraudulent or avoidable transfers, preferential transfers and distributions, and equitable subordination. |
| -4- |

October 9, 2026
Page 5
| b. | Limitations imposed by general principles of equity, whether considered in a proceeding in equity or at law (including, without limitation, the possible unavailability of specific performance or injunctive relief), concepts of materiality, reasonableness, good faith and fair dealing, and the discretion of the court before which a proceeding is brought. We express no opinion regarding the availability of the remedies of specific performance or injunction or other forms of equitable relief, each of which is subject to any available defenses and the discretion of the court or other tribunal before which enforcement is sought. |
| c. | The unenforceability under certain circumstances under law or court decisions of provisions for the indemnification of, or contribution to, a party with respect to a liability where such indemnification or contribution is contrary to public policy. |
| d. | Any provision of the Transaction Documents requiring written amendments or waivers insofar as it suggests that oral or other modifications, amendments or waivers could not be effectively agreed upon by the parties or that the doctrine of promissory estoppel might not apply. We note that a requirement that provisions of the Transaction Documents may be amended or waived only in writing may not be binding or enforceable if an oral agreement has been created modifying such provision or an implied agreement by trade practice or course of conduct has given rise to an amendment or waiver. |
| e. | We express no opinion as to the validity, binding effect or enforceability of: |
| i. | provisions relating to consent to jurisdiction, choice of forum or choice of law, provisions that exclude conflict of laws principles, or provisions that establish particular courts as the forum for the adjudication of any controversy relating to the Transaction Documents, in each case, to the extent not covered by Sections 5- 1401 and 5-1402 of the New York General Obligations Law; |
| ii. | provisions for penalties, liquidated damages, acceleration of future amounts due (other than principal) without appropriate discount to present value, late charges, monetary penalties, make-whole premiums, prepayment charges or increased interest rates upon default; |
| iii. | provisions that contain a waiver of broadly or vaguely stated rights or unknown future rights or defenses; |
| iv. | provisions that contain a waiver of the benefits of statutory, regulatory or constitutional rights, unless and to the extent the statute, regulation or constitution explicitly allows waiver; |
| v. | provisions that contain a waiver of the obligations of good faith, fair dealing, diligence and commercial reasonableness; |
| vi. | provisions that attempt to change or waive rules of evidence or establish evidentiary standards or make determinations conclusive or fix the method or quantum of proof to be applied in litigation or similar proceedings; |
| vii. | provisions for the appointment of a receiver; |
| viii. | provisions that designate acceptable service of process in connection with any litigation or other proceedings arising out of or pertaining to the Transaction Documents; |
| -5- |

October 9, 2026
Page 6
| ix. | provisions that waive rights to trial by jury, designate acceptable service of process, or waive objections to venue or jurisdiction in connection with any litigation or other proceedings arising out of or pertaining to the Transaction Documents; |
| x. | provisions stating that the clauses of a contract are severable; |
| xi. | provisions to the effect that rights or remedies are not exclusive, that every right or remedy is cumulative and may be exercised in addition to or with any other right or remedy, that election of a particular remedy or remedies does not preclude recourse to one or more other remedies, that any right or remedy may be exercised without notice, or that failure to exercise or delay in exercising rights or remedies will not operate as a waiver of any such right or remedy; |
| xii. | provisions contained in any of the Transaction Documents to the extent that such provisions limit the obligation of any party under, or any right of contribution, reimbursement or subrogation of any other party with respect to, any guaranty, third-party pledge or indemnity set forth in such Transaction Document, or the effect of any such provisions on the enforceability of such guaranty, third-party pledge or indemnity; and |
| xiii. | in light of the decision in Official Comm. of Unsecured Creditors of TOUSA, Inc. v. Citicorp N. Am., Inc. (In re TOUSA, Inc.), 422 B.R. 783, 865 (Bankr. S.D. Fla. 2009), order quashed sub nom. 3V Capital Master Fund Ltd. v. Official Comm. of Unsecured Creditors of TOUSA, Inc. (In re TOUSA, Inc.), 444 B.R. 613 (S.D. Fla. 2011), rev’d sub nom. Senior Transeastern Lenders v. Official Comm. of Unsecured Creditors (In re TOUSA, Inc.), 680 F.3d 1298 (11th Cir. 2012), we express no opinion as to the enforceability of provisions in any Transaction Document, known as fraudulent transfer savings clauses, to the extent that such provisions limit the obligation of parties under, or any right of contribution of any other party with respect to, a joint and several or secondary obligation, or the effect of any such provisions on the enforceability of any Transaction Document. |
| f. | We assume the accuracy and completeness of the representations and warranties (as to factual matters) of the Company set forth in the Transaction Documents. |
| g. | We assumed that no party to the Transaction Documents will in the future take any discretionary action (including, without limitation, a decision not to act permitted by the Transaction Documents) that would cause the performance of the Transaction Documents to violate any New York or federal statute, rule or regulation; or require an order, consent, permit or approval to be obtained from a New York or federal government authority. |
| h. | With respect to the opinions set forth in paragraph (f) above, relating to violations of New York state law or federal law or statutes applicable to the Company, we have not conducted any investigation into the types of businesses and activities in which the Company engages or the manner in which the Company conducts its businesses. We have not conducted any special investigation of laws, statutes, rules or regulations. |
| -6- |

October 9, 2026
Page 7
In rendering the opinion set forth in paragraph (a) as to the good standing of the Company, we relied exclusively on a certificate from the Secretary of State of the State of Delaware, dated October 8, 2026. In rendering the opinions set forth in paragraphs (f) and (i) insofar as they require the interpretation of Material Contracts governed by laws other than New York, (i) we have assumed that all courts of competent jurisdiction would enforce such agreements as written but would apply the internal laws of the State of New York without giving effect to any choice of law provisions contained therein or any choice of law principles which would result in the application of the internal laws of any other state, and (ii) to the extent that any questions of legality or legal construction have arisen in connection with our review, we have applied the laws of the State of New York in resolving such questions. We advise you that certain of the Material Contracts may be governed by other laws, that such laws may vary substantially from the law assumed to govern for purposes of this opinion, and that this opinion may not be relied upon as to whether or not a breach or default would occur under the law actually governing such Material Contracts (other than Material Contracts governed by the laws of New York). With respect to paragraph (j) above relating to the Registration Statement being effective, we have relied solely upon the notice of effectiveness received with respect to the Registration Statement and our review of the Company’s filer page on the SEC’s EDGAR filing system at www.sec.gov which, as of 7:00 AM on the date hereof, did not contain a stop order relating to the Registration Statement.
In addition to the foregoing, the opinions expressed above are subject to the following limitations, exceptions, qualifications and assumptions:
We express no opinion as to matters governed by any laws other than the laws, rules and regulations of the State of New York, the DGCL or the federal law, rule or regulation of the United States of America. We express no opinion as to the laws of any other jurisdiction or as to the statutes, administrative decisions, rules, regulations or requirements of any country (other than the United States of America), municipality, subdivision or local authority of any jurisdiction.
In addition, our opinions herein are based upon our consideration of only those statutes, rules and regulations which, in our experience, are normally applicable to transactions of the type contemplated by the Transaction Documents, provided that no opinion is expressed as to any laws relating to (i) hazardous substances, pollution or protection of the environment, (ii) zoning, subdivision, land use, building or construction, (iii) labor, employment, pension, employee rights and benefits, or occupational safety and health, (iv) antifraud matters, (v) antitrust, unfair competition or trade regulation, (vi) state or federal taxation, (vii) state securities regulation, (viii) Sections 547 or 548 of the United States Code (the “Bankruptcy Code”) or comparable provisions of state law, (ix) broker-dealers, investment companies (except as set forth in opinion paragraph 8) or investment advisors, (x) public utilities, (xi) margin regulations, or (xii) insurance or insurance regulation, (xiii) bulk sales, or (xiiii) fiduciary duties, (xv) racketeering or civil forfeiture. In addition, we express no opinion as to compliance with applicable antifraud statutes, rules or regulations of applicable state and federal laws concerning the issuance or sale of securities, including without limitation the accuracy and completeness of the information provided by the Company to the Purchaser.
We confirm to you that we are not representing the Company in any pending action or proceeding in which the Company is a named defendant and that seeks to enjoin the sale and issuance of the Securities or challenge the validity of the Transaction Documents or the performance by the Company of its obligations thereunder.
| -7- |

October 9, 2026
Page 8
We express no opinion on compliance with state or federal requirements for the registration of broker-dealers, agents of broker-dealers or agents of the Company or the effect that non-compliance therewith may have on the offering of the Securities.
Furthermore, we express no opinion with respect to compliance with anti-fraud securities laws, rules and regulations. We further express no opinion concerning the availability of any exemption from agent registration under state securities or “blue sky” laws of any state of the United States. We also express no opinion as to the adequacy or accuracy of any information given, disclosed or made available to prospective purchasers in connection with the offer, issuance and sale by the Company of the Securities.
We do not express any opinion with respect to any laws, rules, regulations or orders concerning declared emergencies in connection with COVID-19 or their effect on the opinions stated herein.
The opinions expressed above concern only the effect of applicable laws currently in effect. We assume no obligation to supplement this opinion letter if any applicable laws change after the date of this opinion letter, or we become aware of any facts that might change the opinions expressed above after the date of this opinion letter.
Our opinions are expressly limited to the matters set forth above, and we render no opinion, whether by implication or otherwise, as to any other matters relating to the Company or the Transaction Documents. The opinions expressed above concern only the effect of applicable laws currently in effect. We assume no obligation to inform you of any facts, circumstances, events or changes in the law that may hereafter be brought to our attention that could alter, affect or modify the opinions expressed herein. This opinion letter is an expression of our professional judgment following our review of the legal issues expressly addressed herein in accordance with customary practice governing opinion letters in transactions such as those contemplated by the Transaction Documents. By rendering our opinion, we neither become an insurer or guarantor of such expression of our professional judgment nor guarantee the outcome of any legal dispute that may arise out of the transactions contemplated by the Transaction Documents.
| Very truly yours, | |
| SHEPPARD, MULLIN, RICHTER & HAMPTON LLP |
| -8- |