Using Atmega324pb

I want to use a custom board with atmega324pb i will use arduino for bootloading . so i just wanted to ask if i can bootload the Arduino ISP on the atmega324pb.
also how must i define the pin numbers of the mcu in the ide because there are more than 35 i/o pin on the mcu

I'm not sure if I understand. Do you want to load the Arduino ISP sketch on your 324PB so you can use the 324PB as a programmer or do you want to use an Arduino as an ISP to program the 324PB?

There is a core that supports the 324PB: GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535

I want to use Arduino to program the atmega324 just once then I'll just fix it on the board

Disclaimer: I've never done this exercise !

I assume that J2 is on your PCB for that purpose.

You connect your board using J2 to the Arduino Uno as described in the various articles about using the Arduino as ISP.

Once you have installed the mentioned board package, you do not have to define it; the pins are defined in a subdirectory of the installation. On my Linux system with portable IDE 1.8.19 installation, it is in /home/wim/Downloads/1_arduino_ide_1.x/arduino-1.8.19-MightyCore/portable/packages/MightyCore/hardware/avr/3.0.2/variants

The 324PB pin definitions are in the file pins_arduino.h in the standard directory. If you search that file for digital_pin_to_bit_mask_PGM, you will see the below

  _BV(0), /* D0, port B */
  _BV(1),
  _BV(2),
  _BV(3),
  _BV(4),
  _BV(5),
  _BV(6),
  _BV(7),
  _BV(0), /* D8, port D */
  _BV(1),
  _BV(2),
  _BV(3),
  _BV(4),
  _BV(5),
  _BV(6),
  _BV(7),
...
...

  #if defined(__AVR_ATmega324PB__)
    _BV(0), /* D32, port E */
    _BV(1),
    _BV(2),
    _BV(3),
    _BV(4),
    _BV(5),
    _BV(6),
  #endif

The first line tells you that Arduino pin 0 is PB0, pin 1 is PB1 etc. You will just have to count. Arduino pin 8 is PD0, Arduino pin 9 is PD1 etc.

I hope this helps.