Ammonium salts are widely used in chemical industries as additives in cement industries, phase change materials in thermal cooling, ionic materials in electrochromic window and multifunction medium/precursor/catalyst in solar cells to improve the efficiency and stability. This work introduces a procedural enhancement by incorporating a liquid-liquid extraction purification process, resulting in a high-purity biobased fatty amide (FA) with tri-substitution and high-purity biobased tetraalkylammonium ammonium salt (TAS). Biobased FA derived from renewable sources was synthesized via an amidation reaction between fatty acids from vegetable oil with tris(3-aminopropyl)amine under reflux conditions, producing a precursor for TAS used in perovskite solar cell (PSC). This study aimed to optimize and determine the reaction condition of biobased FA at various key synthesis variables by investigating the effects of solvent selection, reaction and crystallization, temperature, catalyst, mole ratio, and dehydrating agent on synthesis yield. A multiple liquid-liquid extraction process was employed to enhance the purity of biobased FA by tunning the selection of solvent based on its relative polarity of the reactant and products. Response surface methodology (RSM) and central composite design (CCD) were utilized to optimize the total yield and the three key variables (reaction time, crystallization time, catalyst amount) respectively. The experimental model developed in this study demonstrated a high degree of fitness with the experimental data (F-value = 27.34), p-value < 0.05) and nonsignificant lack of fit. The model predicted a maximum synthesis yield percentage of 52.62 % under optimal conditions (reaction and crystallization time of 12 and 28 hours), respectively with 4.47 % catalyst). The coefficient of determination of R2 = 0.98 shows a high correlation with the predicted values and in good agreement with the experimental values. Physicochemical properties analysis using spectroscopies techniques, confirmed improved purity with 100% abundance yield of tri-substitution biobased FA and enhanced TAS’s purity up to 60%. The optimization study sheds light on the impact of key synthesis variables on the synthesis yield and percentage abundance (purity), advancing the development of more efficient and tailored sustainable construction materials. These findings highlight the potential of using biobased FA as a sustainable source for TAS production, contributing to a more environmentally friendly approach in PSC development.