I’m confused as to whether you are asking if this is ok with the town/city/state or with your lender … or both? Provided you dont need money from a lender, the only codes you would need to follow would be the building codes for your local area. The local zoning office will be able to tell you whether subdividing the lot is permissable, and what standards you will need to meet.
If you need a loan for the property, and you intend to sell it right away, you are inquiring about a “Spec Loan” – a speculative construction loan on a non-owner-occupied home. Local banks tend to be the best source. Some will permit you to be your own contractor and some will require third party oversight of some kind – much of this may be determined based on your reputation and experience as a contractor, and the amount of down payment you are willing to make on the process.
If you choose to obtain an owner occupant’s contruction loan, rather than a spec loan for resale – the expectation is generally that you will live in the home for at LEAST a year after completion (but check with your lender to make sure that this general advice applies to you). After the mandatory time period is up, you could sell the home just as you would with any home you had purchased pre-built. It will not be possible to have two owner-occpant loans at the same time (or one loan for 2 properties), as it is not possible to claim 2 different houses as your primary address at the same time.